Thursday, March 23, 2017

How to limit rows or filter data being pulled from Salesforce Objects to Datasets (specifically on sfdcdigest node)

There are cases where you might want to limit the rows being read from a salesforce object (for example Leads) in a sfdcdigest node in the dataflow. For that, you can use the following:

1- for simple filtering on text or numeric values, use this syntax:

{
    "z-1": {
        "action": "sfdcDigest",
        "parameters": {
            "object": "Lead",
            "fields": [
             
                {
                    "name": "Id"
                },
                {
                    "name": "Division"
                },

                {
                    "name": "BillingDate"
                }
            ],
            "filterConditions" : [
            {
               "field": "Division",
               "operator": "LIKE",
               "value": "Ship01%"
            },
            {
                "field": "FiscalQuarter",
                "operator": "!=",
                "value": "2"
            }
            ]
   },
"z-2": {
      "action": "sfdcRegister",
      "parameters": {
         "alias": "MyFilteredDataset",
         "name": "MyFilteredDataset",
         "source": "z-1"
}
}


note that the operator can by =, <, >, INCLUDES, EXCLUDES, etc... for full list and details check this link:
https://resources.docs.salesforce.com/206/latest/en-us/sfdc/pdf/bi_admin_guide_data_integration_guide.pdf


2- for complex filtering (leveraging a SOQL 'Where' clause to filter the extracted sfdc object), here is an an example (filtering by CreateDate):

{
    "z-1": {
        "action": "sfdcDigest",
        "parameters": {
            "object": "Lead",
            "fields": [
             
                {
                    "name": "Id"
                },
                {
                    "name": "Division"
                },

                {
                    "name": "BillingDate"
                }
            ],
              "complexFilterConditions": "(BillingDate >= 2016-01-01T00:00:00.000Z) AND (BillingDate < 2017-01-01T00:00:00.000Z)"
        }
   },
"z-2": {
      "action": "sfdcRegister",
      "parameters": {
         "alias": "MyFilteredDataset",
         "name": "MyFilteredDataset",
         "source": "z-1"
}
}



No comments:

Post a Comment