简体   繁体   中英

Assignment rules are being ignored when creating a Lead through the Salesforce REST API

I have an old application that uses Web-To-Lead. I'm updating it to use the REST API. We have a bunch of assignment rules set up for Leads. When we create a lead through Web-To-Lead, the Lead is assigned according to our assignment rules. However, when we create a Lead through the REST API, the assignment rules are completely ignored, and the Lead is assigned to the account whose credentials we used to authenticate through OAuth. This has slowed our sales team to a crawl, because now they have to assign leads by hand.

Any ideas how to fix this?

@sangfroid

You want to make sure you set the Assignment Rule Header which should then get the rule to fire off for you.

Paul

====Edit===

It doesn't seem that you can which is a pain. You could try creating a new web service using the Apex REST services stuff (new in Summer '11) which then takes in your Lead data as you have created and runs it using the code at this link .

That should allow you to have the assignment rules run on the inserted Lead and still use a RESTful API. Your own implementation on Salesforce in fact. You could try that code in a trigger on Lead which should get run by the native API as well.

Hope that helps. Apologies for not paying attention on the SOAP REST thing first time round.

Paul

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM