function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Holly ThompsonHolly Thompson 

Why won't my Lead Assignment Rules work on lead imports thru an API, but will work if manually created?

Originally we had the header in the API include a assignment rule ID. We want to use the functionality of useDefaultRules = True and remove the hardcoded value. But with this done, all the leads are not hitting the new active lead assignment rule and are instead going to the default owner.
I do have the page layout properties checkboxes for assignment checked. My new assignment rule is active. The assignment rules have been checked manually and they work, just not with the API sourced leads.

Do we need to hardcode the assignment rules? That is not a path I want to take. Do I have options to get this to work?
 
Sukanya BanekarSukanya Banekar
Hi,
I am not getting whether you are importig lead using some rest API callout or through workbench or data loader or import wizard.

If you are using any data import tool then you to write trigger and use DMLOptions mentioned in the link. 

This article will help you, http://developer.force.com/cookbook/recipe/running-case-assignment-rules-from-apex

Let me know if this helps.

Thanks,
Sukanya Banekar
Onesh ReddyOnesh Reddy
Hi,

This may help you  http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_header_assignmentruleheader.htm                  
                               https://developer.salesforce.com/forums/?id=906F000000099zeIAA  

Regards,
Onesh.K