1. Tasks
  2. Merge Object

Tasks

Merge Object

Stores complex JSON objects and multiple data points into stub.data in one task using json structure.

Basic usage

The merge_object task is ideal for scenarios where you need to either modify existing data or insert new data into the stub.data object. This allows you to accumulate and structure information that can be utilized in subsequent steps of the workflow. Whether you're updating a single field (like a phone number) or adding complex, nested JSON objects (such as a candidate's profile), this task ensures that the data is consistently merged into stub.data. By doing so, you can efficiently store critical information for later use in the process, enabling seamless data continuity and reuse across multiple tasks within the workflow.

Here is an example on how this task might look:

loading...

Parameters

merge_data
required
json

The data structure you wish to store in stub.data. You can define any JSON data element include objects, arrays or standard key, value pairs.


Result

loading...

Properties

merge_data

JSON Object that contains the end result of the Merge Object task with the actual data, after data substitution, as it would be merged into stub.data

Example 2:

In the following example, we will have an action on the template that will be used in order to update the stubs details, in this example the information we are looking to manually update will be the cell number and the email address of a specific person.

In the action we wil first add the two fields that we would like to manually update, once these have been update they will be saved in the following data points:

  • stubpost.data.telephone_field
  • stubpost.data.email_field

We would now like to make sure that the above data points are merged/replace the current data that is stored in:

  • stub.data.candidate_details.cell_number
  • stub.data.candidate_details.email_address

In order to do that, we will add a merge object task and set it up as follows:

editor
        {
  "merge_object": {
    "tasktype": "merge_object",
    "params": {
      "merge_data": {
        "candidate_details": {
          "cell_number": "~~stubpost.data.telephone_field",  // Reference to the updated Cell Number
          "email_address": "~~stubpost.data.email_field"  // Reference to the updated Email Address
        }
      }
    },
    "name": "merge_object",
    "__key": "merge_object"
  }
}

      

Explanation:

cell_number: We are referencing the updated cell number stored in stubpost.data.telephone_field. When the merge action runs, it will substitute this value into stub.data.candidate_details.cell_number, overwriting the previous entry.

email_address: Similarly, the updated email address in stubpost.data.email_field will replace the old email in stub.data.candidate_details.email_address.