Scripts can query data from any data source for which a data action is available. Any scripting component that supports actions can use Data Actions.Execute Data Action to pass necessary inputs to an external interface and then optionally receive data returned in output variables.

About Data Actions.Execute Data Action:

This action allows a script to query data from an outside data source. Typically the outside data source is a CRM or database application. A script can also use this action to pass information collected by the agent to a database or CRM, if the web service supports it.

Notes:
  • Script designers need View and Execute permissions. To add a data action to a script, designers don't need Add, Delete, and Edit permissions. The designer only needs those permissions to add, edit, or delete a data source. See Products, roles, and permissions list.
  • Data actions are not available by default. You must enable the Data Actions script property. 
  • Not every data source can update data from a script:
    • To update a data source using the Web Services Data Dip connector, the web service must be implemented with POST endpoints specifically for this purpose.
    • Data returned to a script from a data action must be in a compatible format. Currently, scripts cannot read data from a JSON array. Some fields returned from Data Dip connectors may currently be inaccessible.

To configure a data action in your script:

  1. Add a button or other component that supports actions. Or, use a page load action to invoke the data action.
  2. Click No Action Selected.
  3. Choose Data Actions.Execute Data Action from the actions popover.
  4. Select an action from the list.
  5. Click Select.
  6. Fill in necessary inputs using variables, static values, or interpolated text.
    Note: The system prompts you to enter input items required by the action. Different actions accept different inputs.
  7. Under Output, optionally create and then assign a variable to each item of data retrieved by the action, if any.
  8. Click Select.

When the action runs, it submits the request with all necessary input values, and then loads the resulting data, if any, to the output variable. The script can use the output variable to display the results. See Use braces to display variable values.

Tip: Data actions cannot be simulated when previewing a script. The system displays a toast message indicating which action it invokes. When you preview a script, the system assigns no data to an output variable.