You need to sign in to do that
Don't have an account?
Adrian Monzon
Lead Assignment rules not working with REST API
Hi there,
I'm using REST API to post data to Salesforce. However, the Lead Assigment rules we've created don't work even if the criteria have been met.
I'm using REST API to post data to Salesforce. However, the Lead Assigment rules we've created don't work even if the criteria have been met.
Are you using standard Lead creation API provide by Salesforce or custom Apex Rest service?
Standard REST API :Set Assignment header
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_header_assignmentruleheader.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_lead.htm#topic-title
Custom APEX REST: Add below code
Database.DMLOptions dmo = new Database.DMLOptions(); d
mo.assignmentRuleHeader.useDefaultRule = true;
dmo.OptAllOrNone = false;
Many people have posted similar issues without any clear solutions I can see. The following header is supposed to give us more control over lead assignments via the REST API, but no matter what does not seem to work with leads: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_autoassign.htm. Maybe OP can have some better luck with it than I have.
(I am creating new Leads through custom Apex REST post service and assignment rules were not activating until using the above)