Transforming Responses for Use in Apply to Each Logic

You can transform the response from one or more actions to create a final response that's available for reference in an Apply to Each step. This final payload can be looped through an Apply to Each sequence to transform each element in the payload for enhanced workflow execution.

Important:

Integration workflows can only have one Apply to Each logic action per workflow. This is designed to avoid excessive processing time, as workflows processing for more than 25 minutes will fail. There is no limit to the number of executions for Apply to Each. However, if paired with Do While Loop logic and using multiple arrays that exceed the Do While Loop's iteration limit of a 1000, the execution will fail and cite an exceeded max count.

OneTrust recommends to send a second Apply To Each loop to process in a subflow workflow. Although only one subflow action is permitted per workflow, this can be bypassed by using POST request actions instead.

For example, you can leverage the subflow action or a generic POST request to effectively chain multiple integration workflows, known as the “workflow chaining” approach. This approach involves triggering another workflow’s webhook trigger and passing the necessary data in the API call’s body.

Note:

For the purposes of demonstrating this feature, the screen references below depict the collection of contacts and companies and their combination as an available array of objects. Customer business needs might require unique actions or array requirements.

To configure the Data Transformation action

  1. On the Integrations menu, select Integrations.

    The Integrations screen appears.

  2. Click on an existing integration or click the Add New button to create a new integration.
  3. In the Integration Builder screen, add a desired action(s) which will produce a payload response.
    Note:

    You will need to return to the action(s) Response tab to enter the sample response you would expect the final desired resulting JSON or XML payload will be of the Data Transformation action.

  4. After this action, add a Data Transformation action.
  5. In the Data Transformation Body tab, add the combined data array you want to use for transformation which can be applied to each subsequent action(s).


  6. In the Data Transformation Response tab, enter the desired payload you want to produce as the result of the transformation.


    Note:

    Providing a sample response is not required; however, you will not be able to reference elements of the Data Transformation action response in other integration actions in that workflow. This still allows for support for existing Data Transformations which may not be configured to return a payload.

    If a sample response is supplied, it will be available for reference in all subsequent selections following that Data Transformation action.

  7. Click the Finish button.
  8. Click the Save button.

To configure the Apply to Each sequence

  1. In the same workflow thread following the Data Transformation step, add a new Apply to Each action step.
  2. Select the reference to an array which was provided in the Data Transformation's Sample field located on the Response tab.
    Note:

    In this use case, we've entered a valid JSON path expression for the property from the JSON of the previous response. A JSON Path expression specifies a path to an element (or a set of elements) in a JSON structure. Paths can use the dot notation.

    Example: $.store.book[0].title



  3. Click the Finish button.
  4. Add actions within the Apply to Each sequence and in the Request tab reference the values from the Data Transformation payload on each instance of the Apply to Each (e.g., HTTP action, database query, parse file, etc.).


  5. Add actions back in the main workflow thread, as necessary. Within each of those additional actions, you can select the specific value of the Data Transformation action payload.
  6. Click the Save button.
  7. Click the Activate button.