Skip to main content
Gainsight Inc.

Merge Tasks using Rules Engine

Gainsight NXT
Gainsight helps innovative companies protect and nurture their most valuable asset - their customers - with the power of our award-winning platform. With our Customer Success Solution, you can gain deeper insights into customer behavior, operationalize the customer lifecycle, and coordinate actions and results across teams.

This article supports Gainsight NXT, the next evolution of the Customer Success platform. New and upgraded customers are deployed on Gainsight NXT.

If you have not upgraded and are using Gainsight Salesforce Edition, you can find supporting documentation here.

Not sure what your team is using? Click here.


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

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.


  1. In the Create Rule screen, enter the required information in the fields available. In this use case, the following information is used as example:
  • Rule For: Company
  • Rule Name: Merge task
  • Folder: select a folder for the rule.
  • Description: [Optional]


  1. Click NEXT. The Setup Rule screen is displayed.

Create Data Set 1 (Fetch Task 1)

  1. Click DATASET to create data set 1.


  1. Enter Task Name (here it is Fetch from Company Object), Task Description (Optional), and Output Dataset Name (here it is Fetch from Company).
  2. Select Company as the source object, add fields in the Show/Filters sections and click SAVE.

Create Data Set_5.png

  1. Click Back [2].png 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

  1. Click Back [2].png 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

Or, if you click Setup Action directly, it will also show the following error message.

Create Data Set_8.png

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 <MRR> is greater than 100 and who have responded to our Surveys.

  1. In the Setup Rule screen, click +TASK > click Merge.

Create Data Set_9.png

  1. 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

  1. In the Criteria section, select the following options for the available fields as used in this example:
  • 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>>(TBA) article.

Create Data Set_11.png

  1. Click + MERGE ON FIELD.
  • Select Source: CSM Company ID, Company ID
  • Select Target: Responded by Company ID, Responded By Company ID  Name.

Create Data Set_12.png

  1. 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:

  • 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.

Create Data Set_13.png

  1. [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 article.
  2. Click SAVE and Back [2].png. The merged task will be available on the Setup Rule screen as shown in the following image.

Enable to S3.gif

Gainsight NXT in Salesforce CRM
Content in this section supports Gainsight NXT customers logging in from the Salesforce CRM. To learn more about Gainsight NXT in Salesforce, click here.


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
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.



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

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

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

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.

  1. In the Setup Rule Action screen, provide the following data as used in this example:
  • 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

Create Data Set_15.png

  1. Click SAVE. For more information on how to set rule actions, refer to the Setup Rule Action Types article.
  2. 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 Scheduling Rules​​​ article.

See Also:

  • Was this article helpful?