0

I am inserting multiple Account records. The default SF duplicate rule finds duplicates. When it is kind of correct, in reality they are not duplicates and we need to ignore the rule.

In the duplicate rule the action on create is set to Allow, Alert, Report.

I'm receiving the exception and record is not created. I'm using Ruby with restforce gem.

1 Answer 1

1

You can "acknowledge" the alert from the duplicate rule via REST API by including Sforce-Duplicate-Rule-Header in your HTTP request. The value of the header is a list of key-value pairs. The key/value you want is described in the doc:

Field name: allowSave

Field values:

true — allow the user to acknowledge the alert and save the duplicate record. Applicable if an alert is enabled for the action.

false— don't allow the user to acknowledge the alert or save the duplicate record. Applicable if an alert is enabled for the action.

This header is available in API version 52.0 or later. This will do it in Restforce:

client = Restforce.new(oauth_token: 'access_token',
                       instance_url: 'instance url',
                       api_version: '54.0',
                       request_headers: { 'Sforce-Duplicate-Rule-Header' => 'allowSave=true' })
1
  • Thank you. It works!
    – Vlad
    Jul 17, 2022 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .