LinkedIn
Copied!

Run script UI 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
A Run Script action with a hard-coded value
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
A Run Script action with a property reference
  • 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.
Suggest Edit
Did you find this content helpful?

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.