Why is my complex filter not working in the SFDC mapping?

Question

Why is this complex filter not working in the SFDC mapping?

 

filter": "notEquals(configuration/entityTypes/Account/attributes/AccountType,'LeadAccount') OR 
notEquals(configuration/entityTypes/Account/attributes/AccountType,'Draft') OR
notEquals(configuration/entityTypes/Account/attributes/AccountStatus,'No-UCM') OR
notEquals(configuration/entityTypes/Account/attributes/AccountStatus,'99') OR
notEquals(configuration/entityTypes/Account/attributes/AccountStatus,'No-UCM') OR
notEquals(configuration/entityTypes/Account/attributes/AccountStatus,99)",

Here is the value of an entity that should not have been sent across the SFDC connector.  As you can see it should not have passed.

 "AccountType": [
            {
"type": "configuration/entityTypes/Account/attributes/AccountType",
"ov": true,
"value": "Draft",
"uri": "entities/Yixh4Ie/attributes/AccountType/1eapJC5l6"
            }
        ],

 

Answer

According to provided filter, the entity will be synchronized if at least one condition is met because it uses 'OR'.


In the provided example the entity has attribute 'configuration/entityTypes/Account/attributes/AccountType' with value 'Draft'. It will be synchronized because the result of the filter will be:

notEquals(configuration/entityTypes/Account/attributes/AccountType,'LeadAccount') = true
notEquals(configuration/entityTypes/Account/attributes/AccountType,'Draft') = false
true OR false = true.


If you don’t want to Synchronize the entity if the attribute value matches any value from the filter you can use 'AND' instead of OR. For example:

”filter” : notEquals(configuration/entityTypes/Account/attributes/AccountType,'LeadAccount') AND notEquals(configuration/entityTypes/Account/attributes/AccountType,'Draft')


The result will be:

notEquals(configuration/entityTypes/Account/attributes/AccountType,'LeadAccount') = true
notEquals(configuration/entityTypes/Account/attributes/AccountType,'Draft') = false
true AND false = false (Entity will be filtered)
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.