In Related actions ,interface is not working as expected

a!localVariables(
  local!pressedButton: "cancel",
  local!getdata: rule!getRequestByID(ri!id),
  {
  
    a!sectionLayout(
      contents: 
      {
        a!boxLayout(
          label: "Approval Form",
          labelSize: "MEDIUM_PLUS",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Comments",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].requestorComments,
                      saveInto: local!getdata[1].requestorComments,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateField(
                      label: "Start Date",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].startDate,
                      saveInto: local!getdata[1].startDate,
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateField(
                      label: "End Date",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].endDate,
                      saveInto: local!getdata[1].endDate,
                      readOnly: true,
                      validations: {}
                    ),
                    a!textField(
                      label: "Email Addresses",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].emailAddresses,
                      saveInto: local!getdata[1].emailAddresses,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Requested By :",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].requestorName,
                      saveInto: local!getdata[1].requestorName,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!textField(
                      label: "Requested Email :",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].requestorEmail,
                      saveInto: local!getdata[1].requestorEmail,
                      refreshAfter: "UNFOCUS",
                      readOnly: true,
                      validations: {}
                    ),
                    a!dateTimeField(
                      label: "Requested On",
                      labelPosition: "JUSTIFIED",
                      value: local!getdata[1].createdOn,
                      saveInto: local!getdata[1].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!requests, local!getdata[1])
                      },

                      submit: true,
                      style: "NORMAL"
                    )
                  },
                  align: "START"
                )
              },
              width: "AUTO"
            ),
            a!columnLayout(
              contents: {
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Approve",
                      saveInto: {

                        a!save(local!getdata[1].auditEmail, loggedInUser()),
                        a!save(local!getdata[1].auditName,loggedInUser()),
                        a!save(local!getdata[1].requestStatus,"Approved"),
                        a!save(local!getdata[1].lastUpdatedOn, now()),
                        a!save( local!getdata[1].lastUpdatedBy, loggedInUser() ),
                        a!save(ri!requests, local!getdata[1]),
                        a!save(ri!submit, true)
                      },
                      submit: true,
                      style: "PRIMARY",
                     
                    ),
                    a!buttonWidget(
                      label: "REJECT",
                      value: "reject",
                      saveInto: {                 
                        a!save(local!pressedButton,"reject"),
                        a!save(local!getdata[1].requestStatus,"Rejected"),
                   

                      },
                    
                      style: "DESTRUCTIVE",
                      disabled: false,
                    
                    )
                  },
                  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!requests.rejectionComments,
                      saveInto:ri!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!rejectCancel, false),
                        a!save(ri!requests, local!getdata[1]),
                        a!save(  local!pressedButton,"cancel")
                      },
                      submit: true,
                      style: "NORMAL"
                    ),
                    a!buttonWidget(
                      label: "Submit",     
                      saveInto: {
                        a!save(local!getdata[1].rejectionComments,ri!Requests.rejectionComments),
                        a!save(local!getdata[1].auditEmail, loggedInUser() ),
                        a!save(local!getdata[1].auditName,loggedInUser()),
                        a!save(local!getdata[1].requestStatus,"Rejected"),
                        a!save(local!getdata[1].lastUpdatedOn, now()),
                        a!save( local!getdata[1].lastUpdatedBy, loggedInUser() ),
                        a!save(local!getdata[1].completedOn,now()),
                        a!save(ri!requests, local!getdata[1]),
                        a!save(ri!rejectCancel, true)

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

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

upon clicking on reject , it will open form for entering rejection comments and after clicking on cancel it should redirect to approve reject form . it is happening in interface but in related actions , when I click reject it shows rejection comments form but upon cancelling it should display approve reject form instead it is redirecting to summary in records

  Discussion posts and replies are publicly visible

Parents Reply Children