Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Implementation of actions in DX API

Updated on January 27, 2022

DX API v1 supports several actions. Learn about the structure of the actions to successfully implement them in your application.

You can use the following actions through DX API:

Local action in DX API

The Local action action loads the local or local & connector flow action and presents it as a modal dialog, overlay, or in an action section. Learn about the JSON structure and elements of a sample Local action action, to understand how you can integrate it into your custom application.

The following JSON code is a sample API response for a Local action action with the Target set to Replace Current:

{
  "actionSets": [
    {
      "actions": [
        {
          "actionProcess": {
            "localAction": "Step1",
            "target": "replaceCurrent"
          },
          "action": "localAction"
        }
      ],
      "events": [
        {
          "event": "click"
        }
      ]
    }
  ]
}
A Local action with the Target set to Replace Current
  • The actionSets, actions, and events elements are arrays.
  • DX API v1 does not support the when conditions in the action set.
  • If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
Note: For the Angular starter kit, note the following statements:
  • When you submit a Local action action, the PUT /assignments/{ID}/actions/{actionID}/refresh endpoint is invoked. This endpoint updates the case page with the data entered by the user and returns the updated page. The Angular starter kit implementation displays the form from which the Local action action was launched. The data entered by the user is not saved in the database.
  • When multiple actions are configured on a control, they are invoked in parallel.

The following JSON code is a sample API response for a Local action action with the Target set to Modal Dialog:

{
  "actionSets": [
    {
      "actions": [
        {
          "actionProcess": {
            "localAction": "Step1",
            "localActionFormat": "Standard",
            "customTemplate": "pzModalActionAreaContainer",
            "target": "modalDialog"
          },
          "action": "localAction"
        }
      ],
      "events": [
        {
          "event": "click"
        }
      ]
    }
  ]
}
A Local action with the Target set to Modal Dialog
  • The actionSets, actions, and events elements are arrays.
  • DX API v1 does not support the when conditions in the action set.
  • If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
Note: For the Angular starter kit, note the following statements:
  • When you submit a Local action action, the PUT /assignments/{ID}/actions/{actionID}/refresh endpoint is invoked. This endpoint updates the case page with the data entered by the user and returns the updated page. The Angular starter kit implementation displays the form from which the Local action action was launched. The data entered by the user is not saved in the database.
  • When multiple actions are configured on a control, they are invoked in parallel.

The following JSON code is a sample API response for a Local action action with the Target set to Modal Dialog:

{
  "actionSets": [
    {
      "actions": [
        {
          "actionProcess": {
            "localAction": "Step1",
            "localActionFormat": "Standard",
            "customTemplate": "pzModalTemplate",
            "target": "overlay"
          },
          "action": "localAction"
        }
      ],
      "events": [
        {
          "event": "click"
        }
      ]
    }
  ]
}
A Local action with the Target set to Overlay
  • The actionSets, actions, and events elements are arrays.
  • DX API v1 does not support the when conditions in the action set.
  • DX API v1 supports the out of the box Overlay formats. Configured user-defined overlay formats are also returned in the response.
  • If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
Note: For the Angular starter kit, note the following statements:
  • The Angular starter kit does not support Overlay.
  • The Click event is supported by the Angular starter kit. However, the DX API response returns any configured event.

Refresh action in DX API

The Refresh action reloads a part of the UI when a specified event occurs (for example, when a user clicks a button). Learn about the JSON structure and elements of a sample Refresh action, to understand how you can integrate it into your custom application.

The following JSON code is a sample API response for the Refresh action with a data transform and an activity:

{
  "actionSets": [
    {
        "actions": [
            {
                "action": "refresh",
                "refreshFor": "cHlUZW1wbGF0ZUJ1dHRvbiNweEJ1dHRvbiMxNmNjNmYwMS01MjNhLTQ5NTMtYjFhYy04NmIzMzc5%0AMzQwZmI%3D"
            }
        ],
        "events": [
            {
                "event": "click"
            }
        ]
    }
]
}
A Refresh action with a data transform and an activity

An action set that is configured to refresh a section will always return the refreshFor element, which refreshes the section, in the JSON response. The refreshFor element functions as the ID in the following API endpoint that initiates the data transform or activity configured in the action set: /assignments/{assignmentID}/actions/{actionID}/refresh?refreshFor={refreshForID}.

Note:
  • DX API v1 does not support the following actions:
    • Refresh-Current Harness
    • Refresh-Other Section

    The JSON response returns the value for the refreshFor element but the API endpoint does not initiate the data transform or activity configured in the action set.

  • DX API v1 does not support the Disable submit on refresh check box and the when conditions in the action set.

Run script action in DX API

The Run script action calls a custom JavaScript function when a specified event occurs (for example, when a user clicks a button). Learn about the JSON structure and elements of a sample Run script action, to understand how you can integrate it into your custom application.

The following JSON code is a sample API response for the Run script action with a hard-coded value:

{
    "actionSets": [
    {
        "actions": [
            {
                "actionProcess": {
                    "functionName": "alert",
                    "functionParameters": [
                        {
                            "name": "",
                            "value": "\"hello\""
                        }
                    ]
                },
                "action": "runScript"
            }
        ],
        "events": [
            {
                "event": "click"
            }
        ]
    }
]
}
A Run Script action with a hard-coded value
Note:

You can configure multiple Name-Value pairs. All such pairs are listed in the functionParameters array.

The following JSON code is a sample API response for the Run script action with a property reference:

{
    "actionSets": [
    {
        "actions": [
            {
                "actionProcess": {
                    "functionName": "printVal",
                    "functionParameters": [
                        {
                            "valueReference": {
                                "reference": "InputRunScript",
                                "lastSavedValue": "hello world"
                            },
                            "name": "value"
                        }
                    ]
                },
                "action": "runScript"
            }
        ],
        "events": [
            {
                "event": "click"
            }
        ]
    }
]
}
A Run Script action with a property reference
Note:
  • You can configure multiple Name-Value pairs. All such pairs are listed in the actionSets.actions[0].actionProcess.functionParameters array.
  • The lastSavedValue element is the value that the referenced property (reference) contains.
  • DX API v1 does not support the when conditions in the action set and the Register OOTB actions used in script for URL tamper proofing check box.

Set value action in DX API

The Set value action assigns a source value to a target property in the UI. Learn about the JSON structure and elements of a sample Set value action, to understand how you can integrate it into your custom application.

The following JSON code is a sample API response for the Set value action with a hard-coded value:

{
"actionSets": [
    {
        "actions": [
            {
                "actionProcess": {
                    "setValuePairs": [
                        {
                            "name": "ResponseSetValue",
                            "value": "\"abcd\""
                        }
                    ]
                },
                "action": "setValue"
            }
        ],
        "events": [
            {
                "event": "click"
            }
        ]
    }
]
}
A Set Value action with a hard-coded value
Note:

You can configure multiple Property-Value pairs. All such pairs are listed in the setValuePairs array.

The following JSON code is a sample API response for the Set value action with a property reference:

{
    "actionSets": [
    {
        "actions": [
            {
                "actionProcess": {
                    "setValuePairs": [
                        {
                            "valueReference": {
                                "reference": "InputSetValue",
                                "lastSavedValue": "a quick brown fox"
                            },
                            "name": "ResponseSetValue"
                        }
                    ]
                },
                "action": "setValue"
            }
        ],
        "events": [
            {
                "event": "click"
            }
        ]
    }
]
}
A Set value action with a property reference
Note:
  • You can configure multiple Property-Value pairs. All such pairs are listed in the setValuePairs array.
  • The lastSavedValue element is the value that the referenced property (reference) contains.
  • DX API v1 does not support the when conditions in the action set.

Perform action in DX API

The Perform action action submits flow actions and completes assignments under certain conditions. Learn about the JSON structure and elements of a sample Perform action action, to understand how you can integrate it into your custom application.

The following JSON code is a sample API response for the Perform action action with a hard-coded value:

{
  "actionSets": [
    {
      "actions": [
        {
          "actionProcess": {
            "actionName": "PortletAction"
          },
          "action": "takeAction"
        }
      ],
      "events": [
        {
          "event": "click"
        }
      ]
    }
  ]
}
A Perform action with a Flow action
  • The actionSets, actions, and events elements are arrays.
  • DX API v1 does not support the when conditions in the action set.
Note:

For the Angular starter kit, note the following statements:

  • Perform action invokes the POST /assignments/{ID}?actionID={actionID} endpoint, and then the data that users enter is saved in the data base.
  • The implementation displays the form from which the action was launched.
  • Only the Click event is supported. The remaining events are returned in a DX API response, but have no effect.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us