--- title: "Merge Tasks using Rules Engine" slug: "merge-tasks-using-rules-engine" updated: 2026-11-23T12:31:41Z published: 2026-11-23T12:31:41Z canonical: "support.gainsight.com/merge-tasks-using-rules-engine" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.gainsight.com/llms.txt > Use this file to discover all available pages before exploring further. # Merge Tasks using Rules Engine This article explains how Gainsight’s Rules Engine integrates raw customer data into Gainsight, and performs multi-step data transformations with a merge option that transforms the data into a polished, actionable dataset ## Merge Tasks with Rules Engine Gainsight’s Rules Engine integrates raw customer data into Gainsight and design multi-step data transformations with a merge option that transforms the data into a polished, actionable dataset. ![Merge Tasks with Rules Engine_1.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Merge_Tasks_with_Rules_Engine_1.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=oTKhUxCjbVgV3ygk4xzCtKrueAXXfJpqG2moiNy7SMU%3D) **Note**: Merging a dataset to itself (Self-Merge) is not supported in Rules Engine. ## Create a Rule 1. Navigate to **Rules Engine > RULES LIST** tab. 2. Click **+RULE.** ![RED1.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/RED1(1).png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=oitl4I1iGobqZVV2IiN2NgF7AFqaA5YU931s05GZrXg%3D) 3. In the **Create Rule** screen, enter the required information in the fields available. In this use case, the following information is used as example: ![0 (1836×729) 2023-03-01 at 7.33.02 PM.jpg](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/0_(1836%C3%97729)_2023-03-01_at_7.33.02_PM(1).jpg?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=4RGExzOKV7M2c27YLYfy5LXPwCkhGfhhzIdNhU00tZc%3D) - **Rule For:** Company - **Rule Name:** Merge task - **Folder**: select a folder for the rule. - **Description:** *[Optional]* 4. Click **NEXT**. The **Setup Rule** screen is displayed. ### Create Data Set 1 (Fetch Task 1) 1. Click **DATASET** to create data set 1**.** ![clipboard_eda883cf45d9d55b45af38b8af71fe842.png (1839×595) 2023-03-01 at 7.34.12 PM.jpg](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/clipboard_eda883cf45d9d55b45af38b8af71fe842.png_(1839%C3%97595)_2023-03-01_at_7.34.12_PM(1).jpg?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=Mikq9uuOrAivgWUADnkqZTyaQ3fqfbyIS8MuRG49Og4%3D) 2. **Enter Task Name** (here it is *Fetch from Company Object*), **Task Description** (*Optional*), and **Output Dataset Name** (here it is *Fetch from Company*)**.** 3. Select **Company** as the source object, add fields in the **Show/Filters** sections and click **SAVE.** ![Create Data Set_5.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_5.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=psNGk9JREfZcgLCs6GGtEpkmL7qDm7mdYdedBaeUWHM%3D) 4. Click ![Back [2].png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Back_[2].png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=DkreH%2BFK4PrWiOh4oL5md4Hmabf7KMaSw4gl08Jw6zE%3D) to go to the **Setup Rule** screen where you can view the first fetched dataset that is performed in this **Rule**. ### Create Data Set 2 (Fetch Task 2) 1. Click **+TASK > Dataset** to create data set 2. 2. Enter **Task Name** (here it is ***fetch from Survey Participant***), **Task Description** (Optional), and **Output Dataset Name** (here it is ***fetch from MDA***). 3. Select **Survey Participant** as the source object, add fields in the **Show/Filters** sections and click **SAVE.** ![Create Data Set_6.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_6.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=m4pkQhSJXDZS6GU6P8%2B1uumvBRjNbiwmUcLFybrzJR4%3D) 4. Click ![Back [2].png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Back_[2].png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=DkreH%2BFK4PrWiOh4oL5md4Hmabf7KMaSw4gl08Jw6zE%3D) to go to the **Setup Rule** screen where you can view the second fetched data set that is performed in this **Rule**. If you click **NEXT**, it shows the following error message. ![Create Data Set_7.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_7.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=8kaDu00wsjI%2F%2FcvANLcmeetNjkRtiT9JlMNbSTNjK1A%3D) Or, if you click **Setup Action** directly, it will also show the following error message. ![Create Data Set_8.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_8.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=w7ZKoeJf%2FYG1EovJEf6k510bzS6pd0svbGUxaFvw3do%3D) The reason behind showing these error messages is for having two output tasks available in the **Setup Rule** screen. You should apply merge/pivot/aggregate multiple datasets to one output dataset to proceed further. The following sections provide step-by-step guidelines about how you can apply merge/pivot/aggregate multiple datasets fetched from multiple/single sources to create a single dataset task. Even though you can setup actions on all the dataset tasks in a rule, you should apply merge and create a single output dataset task. Even if you do not want to setup an action on the final output dataset task, it should be created else the actions you setup on any dataset task will not be executed. ### Merge Task to create single output We now create a merge task which retains all records of Customers whose is greater than 100 and who have responded to our [*Surveys*](/v1/docs/create-a-survey). 1. In the **Setup Rule** screen, click **+TASK >** click **Merge**. ![Create Data Set_9.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_9.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=Nvtak8dY3f%2FcauzuQ%2FSu1YleKBpS1%2FrLRjZuo5mcrs0%3D) 2. Enter **Task Name** (here it is ***merge task***), **Task Description** *(Optional)*, and **Output Dataset Name** (here it is ***merge task***). ![Create Data Set_10.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_10.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=y738f1R6aJRQVXy4Miq7QW65bdlU2bPrT51s5kIHfSo%3D) 3. In the **Criteria** section, select the following options for the available fields as used in this example: ![Create Data Set_11.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_11.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=jGr7401MaVKPlAudGHParyL7MBu22DJS4TnEsXRlYz4%3D) - **Merge**: Fetch from Company - **With**: Fetch from Survey Participant - **Select Join Type**: Retain common records from both dataset ​​​​​​**Note**: For information about various join types, refer to the [*Join Types*](/v1/docs/join-types) article**.** 4. Click + **MERGE ON FIELD**. ![Create Data Set_12.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_12.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=fURYoSyzhM3iP61MOZ1TztIkoTj2d%2FJ%2Bw53%2Fm5gcRdA%3D) - **Select Source**: CSM Company ID, Company ID - **Select Target**: Responded by Company ID, Responded By Company ID Name. 5. The **Show Fields** section displays the list of fields fetched from both the Datasets. You can select the required fields to be displayed in the final result. Use the **Show Selected** checkbox: ![Create Data Set_13.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_13.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=54w0VWx8QhqarmWscosGT3bkiRYeB%2Fzu1GQqshB4%2BAA%3D) - Select to view the fields used in the merge task. - De-select to view the newly added field in the respective Dataset task that is used in the merge task. 6. *[Optional]* Select the **Enable to S3** check box if you want to export it to S3. For more information about how you can Export to S3, please refer to the [*Export to S3 from Gainsight Rule*](/v1/docs/export-to-s3-from-rules-engine) article. 7. Click **SAVE** and ![Back [2].png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Back_[2].png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=DkreH%2BFK4PrWiOh4oL5md4Hmabf7KMaSw4gl08Jw6zE%3D). The merged task will be available on the **Setup Rule** screen as shown in the following image. ![Enable to S3.gif](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Enable_to_S3.gif?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=e5zynwmZ637J72FmHi1piJQsdIfYIZZgojSLJXyWuXI%3D) --- Gainsight NXT in Salesforce CRM Content in this section supports Gainsight NXT accessing through Salesforce Login. To learn more about Gainsight NXT in Salesforce, click [here](/docs/merge-tasks-using-rules-engine#). **Click here for more information about merging datasets created from Salesforce objects, with Gainsight Objects** If you have enabled Salesforce Connector, you can create Datasets from Salesforce objects. You can then merge Salesforce Datasets with Gainsight Datasets or even merge two Salesforce Datasets.![Merge tasks with SFDC.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Merge_tasks_with_SFDC.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=cY1gJ746%2BoIaO10HjkM5t7opW0%2BRlLTLLutjjlCW2r4%3D) In the following image, Account Object from Salesforce is merged with Company object from Gainsight. The Account ID field from Account object and SFDC Account ID field from Company object is used for mapping.![EC80309A-EC75-4843-8856-9964C67A4EC2.GIF](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/EC80309A-EC75-4843-8856-9964C67A4EC2.GIF?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=ftS3VYkv09nCx5T6LQkmLVVKVTBm6Ny5%2B98msXx83Ww%3D) --- ### Usage scenarios for Merge task You can save a rule with multiple datasets even without using a Merge task, provided all your datasets are interconnected, thus resembling a tree structure. However, If you have created two or more independent datasets, you will still require a Merge task. #### Merge task is not required in the following case In the following diagram, a single dataset is created (Dataset A). A transformation task and a Pivot task were created from this Dataset. In this case, Merge task is not required since output datasets are interconnected, reminiscent to a tree structure. You can also create multiple transformation and pivot tasks on Dataset A, without requiring a Merge task. ![Case one.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Case_one.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=ybbYihg2%2BAGCG%2Fp%2BuZgss19dKAxJ3vhYLkdxrMwvO00%3D) #### Merge task is required in the following case In the following diagram, two datasets A and B are created. These two datasets are independent and not connected in any way. Thus, a Merge task is required in this case. ![Case two.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Case_two.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=uadnKs50QMEj8njmGobw3cS46SRN0Iu%2BieBVhG%2FiIHo%3D) If you create a Transformation task or Pivot task on any of the above datasets, you will still require a Merge task. ![Case three.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Case_three.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=uV7nO%2FrfT0vthL56S1vr4f%2Fm66gSsyJGG2oveWDPjkQ%3D) In the above case, you must create a Merge task to combine the transformation task from Dataset A and Pivot task from Dataset B. ## Perform Action We now create a Action for our Rule in which a CTA is created for every Customer whose MRR is greater then or equal to 100 and who responded to our [*Surveys*](/v1/docs/create-a-survey). 1. In the **Setup Rule Action** screen, provide the following data as used in this example: ![Create Data Set_15.png](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/Create_Data_Set_15.png?sv=2026-02-06&spr=https&st=2026-11-24T16%3A44%3A22Z&se=2026-11-24T17%3A44%3A22Z&sr=b&sp=r&sig=9s3ESbEVpMfkMf0qtKCRbsDhNBPjQcT4fGgfbHuBT3E%3D) - **Action Type**: Call to Action 2.0 - **Company Identifier:** Company Id - **Name:** Enter a name - **Type:** Activity - **Priority**: High - **Reason**: Survey Response - **Default Owner**: Select a default owner for the CTA 2. Click **SAVE**. For more information on how to set rule actions, refer to the [*Setup Rule Action Types*](/v1/docs/set-up-rule-action-types) article. 3. Click **RUN NOW** to test the newly created rule. The **Run Rule** window is displayed. You can mention an email id where you want to receive a copy of the **Rule Result** and then click **RUN**. ### Schedule the Rule Use this option to schedule the execution of this rule in the same way you have scheduled custom rules. For more information about how to schedule an individual rule, refer to the [*Schedule and Execute Rules*​​​](/v1/docs/schedule-and-execute-rules-1) article**.** **See Also**: - [*Create Tasks in Rules Engine*](/v1/docs/create-tasks-in-rules-engine) - [*Pivot Tasks in Rules Engine*](/v1/docs/pivot-tasks-in-rules-engine) - [*Transformation Tasks in Rules Engine*](/v1/docs/transformation-tasks-in-rules-engine) - [*Aggregate* *Usage Data with Rules Engine*](/v1/docs/aggregate-usage-data-with-rules-engine)