Table of Contents

Article

How to refresh any section on a user form using a click-action control

Summary

As of V6.2, you can use the standard pxButton, pxLink, or pxIcon auto-generated controls to refresh a section in which it is located, or any other section on the user form. In releases before V6.2, you can only refresh the section containing the control. The current approach enables you to reuse the target section, and eliminates the need for wrapper sections.

You can expand the control's capability by triggering multiple actions on a single click. This article describes how to configure a button to perform a local action and also refresh another section when a user clicks a button control.

In V6.2, you can also refresh any included section by specifying a Refresh When condition. See the Refresh on Change example in Process Commander at > User Interface > UI Gallery.

 

 

Suggested Approach

In the following example, you will add a button to a flow action (named CustomerSearch) that lets the user attach a claim history report if the loan applicant is an existing customer. Here is the runtime behavior:

    1. When the user creates a new application, the form displays an Is this an existing customer? checkbox in the Search for a Customer flow action.





      When checked, the

Attach Claim History

      button appears and a message "[Not Attached]" indicates that the document has not been attached.





    1. When the user clicks the button, the system displays an Add Attachments dialog. The user enters the file information and clicks OK to submit the local action and close the dialog.





    1. On the flow action form, the system changes the message to "Claim History Attached." The system uploads a copy of the file and links it to the history of the case. The file appears on the Attachments tab on the user form, and on the audit trail window.



How to configure

You will follow these major steps:

  1. Create a section that contains both messages.
  2. Create a Visible When condition for each message, and embed the section in another section that is included in the flow action
  3. Create a data transform rule that toggles the message values. You will add this rule to the local flow action (attach file).
  4. Create a button that initiates the local action and refreshes the section that contains the messages after the attachment is submitted.
  5. Create a Visible When condition for the message section so that it appears only when the Existing Customer checkbox is selected.

1. Create a section that contains the messages

    1. Create a section (named ClaimAttached in this example), and add two layouts.
    2. In each layout, enter the message text as shown below (custom styles created in the Branding wizard have been applied):



2. Create a Visible When condition for each message

    1. Create a Single Value property named .File in your work class.
    2. Click the magnifying glass icon ( ) in the Not Attached Layout header to open the the layout properties panel, and enter .File= '' (two single quotes) in the Visible When field.



    1. In the Claim History Attached Layout properties panel, enter .File!='' in the Visible When field.





      Because you are refreshing the section, do not click the

Run on Client

      checkboxes.



    1. Save the rule.
    2. Create a section (named .ClaimAttachYesNo in this example) and add a layout.
    3. Embed the ClaimAttached section in a layout cell.





  1. Save the rule.

3. Create a data transform rule and add it to the flow action

    1. Create a data transform rule (named FileAttachTransform in this example).
    2. Enter the values as shown below:





    1. Save the rule.
    2. Copy the standard flow action Work-.AddAttachments to your application RuleSet and work class (do not change the Purpose key part).
    3. In the After This Action area on the Action tab, select your data transform rule in the Data Transform field. This value ensures that the message changes only after the local action is submitted.





  1. Save the rule.

 

4. Configure the pxButton control

    1. Create a section (named FileNotify in this example) that contains the pxButton control and add a layout.
    2. Add a button control to a layout cell.
    3. Click the cell's magnifying glass icon ( ) to open the Cell Properties panel.





    1. Click the magnifying glass icon ( ) next to the Control field to open the button's Parameters dialog.
    2. Modify the Label value as shown below:






    1. In the Behaviors area, click the Add Row icon.





      The Behavior dialog appears.



    1. Select Click in the Event drop-down.
    2. Select the Action menu item Launch > Local Action.





    1. Select AddAttachments in the Local Action field.
    2. Select the Open in Modal Dialog checkbox.





    1. Click OK to close the dialog.
    2. Add another row, select Click, and select the Action menu item Display > Refresh Section. This is the second action that is triggered after the local action is submitted.





    1. In the Behavior dialog, select Other Section in the Target drop-down.
    2. Select ClaimAttachYesNo in the Section field.





    1. Click OK to close the dialog.

 

      The completed Parameters dialog looks like this:





  1. Click OK to close the dialog.
  2. Close the Cell Properties panel.

5. Add the sections to the flow action and create a Visible When condition

    1. Include the AttachFileYesNo section in the FileNotify section and save the FileNotify section.



    2. Include the FileNotify section in the CustomerSearch section (referenced by the CustomerSearch flow action).





    1. Open the Section Include properties panel of the FileNotify section.
    2. In the Visible When field, enter the expression .IsExistingCustomer = true.
    3. Select the Run On Client checkbox.



  1. Close the panel and save the rule.
  2. Run the process to test the configuration.

Published July 8, 2011 — Updated October 14, 2011


100% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.