What is the best practice for using a!save on a record in a record view?

Hi, I'm trying to understand best practice here because what I did, works, but i'm not sure if it is the best way to be doing things.

I have a record view with an approve and deny button. A user starts from a table and clicks the master record id to drill in to the record view.

Once on the record view, upon clicking the approve or deny button I run an a!Save on the record to update the status of it to either approved or denied without ever executing a process model. It updates the records status. On the record view I see the record status update and when i return to the main screen which has a table of all the records it is updated there as well.

a!buttonLayout(
    secondaryButtons: {
      a!buttonWidget(
        label: "Deny",
        style: "DESTRUCTIVE",
        saveInto: {
          a!save(
            ri!record['recordType!{...}status'],
            cons!MP_DENY
          )
        },
        disabled: if(
          ri!record['recordType!{...}status'] <> cons!MP_PROCESSED,
          true,
          false
        )
      )
    },
    primaryButtons: {
      a!buttonWidget(
        label: "Approve",
        style: "PRIMARY",
        saveInto: {
          a!save(
            ri!record['recordType!{...}status'],
            cons!MP_APPROVED
          )
        },
        disabled: if(
          ri!record['recordType!{...}status'] <> cons!MP_PROCESSED,
          true,
          false
        )
      )
    },
)

Is this ok? Should I be doing this instead by calling a a!startProcess or a!recordActionField?

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    It's ok - as long as it satisfies your requirements and any surrounding organizational requirements for traceability etc.  The one issue with this sort of "live, on-form write" approach is that it doesn't leave behind a trackable trail like a process instance will have.  In many cases that's just fine, but must be evaluated on a case-by-case basis of course.

    As an aside: i think there might be too many "Mike S"'s around here Grin

Reply
  • +1
    Certified Lead Developer

    It's ok - as long as it satisfies your requirements and any surrounding organizational requirements for traceability etc.  The one issue with this sort of "live, on-form write" approach is that it doesn't leave behind a trackable trail like a process instance will have.  In many cases that's just fine, but must be evaluated on a case-by-case basis of course.

    As an aside: i think there might be too many "Mike S"'s around here Grin

Children