Skip to main content
August 1, 2023
Question

Error in process model

  • August 1, 2023
  • 7 replies
  • 0 views

a!localVariables(
  local!pressedButton: "cancel",
  local!getdata: rule!test_getRequestByID(ri!id),
  {
    a!columnsLayout(    
      columns: a!columnLayout(
        contents: a!sectionLayout(
          contents: {
            a!richTextDisplayField(
              value: a!richTextItem(
                text: if(
                  a!isNullOrEmpty(local!getdata.lastUpdatedBy),
                  "Already a user is working on this request",
                  rule!GBL_displayUserFirstLast(loggedInUser()) & " is working on this request"
                ),
                color: "SECONDARY",
                size: "LARGE",
                style: "STRONG"
              ),
              showWhen: not(ri!editable)
            )
          }
        )
      )
    ),
    a!sectionLayout(
      contents: 
      {

        a!boxLayout(
          label: "Audit Approval Form",
          labelSize: "MEDIUM_PLUS",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Comments",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.requestorComments,
                      saveInto: local!getdata.requestorComments,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateField(
                      label: "Start Date",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.startDate,
                      saveInto: local!getdata.startDate,
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateField(
                      label: "End Date",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.endDate,
                      saveInto: local!getdata.endDate,
                      readOnly: true,
                      validations: {}
                    ),
                    a!textField(
                      label: "Email Addresses",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.emailAddresses,
                      saveInto: local!getdata.emailAddresses,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Requested By :",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.requestorName,
                      saveInto: local!getdata.requestorName,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!textField(
                      label: "Requested Email :",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.requestorEmail,
                      saveInto: local!getdata.requestorEmail,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateTimeField(
                      label: "Requested On",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata.createdOn,
                      saveInto: local!getdata.createdOn,
                      readOnly: true,
                      validations: {}
                    )
                  }
                )
              }
            )
          },
          style: "#efefef",
          shape: "ROUNDED",
          padding: "STANDARD",
          marginBelow: "STANDARD",
          showShadow: false 
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Cancel",
                      saveInto: {
                        a!save(ri!submit, false),
                        a!save(ri!test_requests, local!getdata)
                      },

                      submit: true,
                      style: "NORMAL"
                    )
                  },
                  align: "START"
                )
              },
              width: "AUTO"
            ),
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Approve",
                      saveInto: {
                        a!save(local!getdata.auditEmail, loggedInUser()),
                        a!save(local!getdata.auditName,rule!GBL_displayUserFirstLast(loggedInUser()) ),
                        a!save(local!getdata.requestStatus,cons!test_AUDIT_STATUS_TYPES[2]),
                        a!save(local!getdata.lastUpdatedOn, now()),
                        a!save( local!getdata.lastUpdatedBy, loggedInUser() ),
                        a!save(ri!test_requests, local!getdata),
                        a!save(ri!submit, true)
                      },
                      submit: true,
                      style: "PRIMARY",
                      showWhen: (ri!editable)

                    ),
                    a!buttonWidget(
                      label: "REJECT",
                      value: "reject",
                      saveInto: {                 
                        a!save(local!pressedButton,"reject"),
                        a!save(local!getdata.requestStatus,cons!test_AUDIT_STATUS_TYPES[3])

                      },
                      style: "DESTRUCTIVE",
                      disabled: false,
                      showWhen: (ri!editable),
                    )
                  },
                  align: "END"
                )
              }
            )
          }
        )
      },
      showWhen: local!pressedButton= "cancel"
    ),
    a!sectionLayout(
      contents: {
        a!boxLayout(
          label: "Rejection Comments ",
          labelSize: "SMALL",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Comment",
                      labelPosition: "JUSTIFIED",
                      placeholder: "Please Provide Rejection Comments",
                      value: ri!test_requests.rejectionComments,
                      saveInto:ri!test_requests.rejectionComments,
                      refreshAfter: "UNFOCUS",
                      validations: {}

                    )
                  }
                )
              }
            )
          },
          style: "#efefef",
          shape: "ROUNDED",
          padding: "STANDARD",
          marginBelow: "STANDARD"
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Cancel",
                      value: "cancel",
                      saveInto: {
                        a!save(ri!cancel, false),
                        a!save(ri!test_requests, local!getdata),
                        a!save(  local!pressedButton,"cancel")
                      },
                      submit: false,
                      style: "NORMAL"
                    ),
                    a!buttonWidget(
                      label: "Submit",     
                      saveInto: {
                        a!save(local!getdata.rejectionComments,ri!test_requests.rejectionComments),
                        a!save(local!getdata.auditEmail, loggedInUser() ),
                        a!save(local!getdata.auditName,rule!GBL_displayUserFirstLast(loggedInUser())),
                        a!save(local!getdata.requestStatus,cons!test_AUDIT_STATUS_TYPES[3]),
                        a!save(local!getdata.lastUpdatedOn, now()),
                        a!save( local!getdata.lastUpdatedBy, loggedInUser() ),
                        a!save(local!getdata.completedOn,now()),
                        a!save(ri!test_requests, local!getdata),
                        a!save(ri!submit, true)

                      },
                      submit: true,     
                      style: "DESTRUCTIVE"
                    )
                  },
                  align: "END"
                )
              }
            )

          }
        )
      },
      showWhen:local!pressedButton="reject"
    )
  }
)

In this interface I have added code (from  line 11 to 15 ) to check if one person is working/opened it then for other person who is trying to open it should say "person is already working on it "

can you please help me with this and I'm getting error in the process model 

7 replies

stefanhelzle0001
Brainy
August 1, 2023

I think you pass a null value to the rule input "editable" and this line fails

showWhen: not(ri!editable)

sabat0002Author
August 1, 2023

I need to pass it from process model not from interface,can you help me with it

stewart.burchell
August 1, 2023

Doesn't matter where it comes from...you need to ensure that when it is used in your not() function it isn't null. Or do you mean you're not sure *how* to pass it to the interface from the process model?

stewart.burchell
August 1, 2023

The error message is telling you that the function 'not' will not accept a null value. So you need to pre-emptively replace a null value with either 'true' or 'false' (whatever makes sense in your scenario)