Skip to main content

Run script UI action in DX API

Suggest edit Updated on January 13, 2022

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.
Did you find this content helpful? YesNo

0% found this useful

Have a question? Get answers now.

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

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

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