Skip to main content
June 22, 2023
Question

In Related actions ,interface is not working as expected

  • June 22, 2023
  • 6 replies
  • 0 views

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

    6 replies

    sabat0002Author
    June 22, 2023

    can someone please help me 

    mathieud0001
    Brainy
    June 22, 2023

    You'll need 2 cancel buttons I believe (or a bi modal one).

    One which returns you to the summary on the initial page.

    And one on your rejection comments screen which returns you to the previous screen.

    For the second scenario, you'll need to set submit = false on your cancel button.

    sabat0002Author
    June 22, 2023

    And After approving the form , again the form is getting displayed in related actions . once we approve I believe we shouldn't see that form again .can you please help me

    mathieud0001
    Brainy
    June 22, 2023

    Do you have a user input task in your process by any chance?