Reputation: 43
I'm using JSforce to integrate Salesforce into my app. When I update a Salesforce account from my end via JSforce update function, it got DUPLICATES_DETECTED error because Salesforce considers this account is duplicate with another one. Although I set Allow in Duplicate rule setting of the Salesforce page and we can edit successfully this account on it, It cannot be done via API (with using JSforce) from my end because of this error. Is this possible to bypass Duplicate Management via JSforce without disabling these rules?
const jsforce = require('jsforce');
/* Update to Salesforce */
update: function (updateObject, callback) {
this.getSObject().update(updateObject, callback);
}
Some documents suggest setting allowSave to true in header of request via API soap like this but I don't use API soap, I'm using JSforce instead.
Upvotes: 1
Views: 639
Reputation: 340
You just got possibility to do this in REST API, which jsforce uses.
You can do it this way:
sfConnection.sobject("Account").create(mappedAccounts, {
allowRecursive: true,
headers: {
'Sforce-Duplicate-Rule-Header': 'allowSave=true'
}
});
This is not explicitly explained in documentation, but you can figure it out from their code. Other possible values you can find here: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_duplicaterules.htm
Upvotes: 0