I am having a problem with Force.com SDK for C#. the UpdateAsync function is updating Lead owner automatically every time I update any field on the lead. Here's the code that I am using

var success = await client.UpdateAsync("Lead", testingLeadId, new { Title = "Testing ", Description = "Testing From a new method" });

I used Workbench to check if there is a role that is changing the lead owner when it comes to SF but does not seem like it.

Any Ideas/suggestions ?

Thanks in advance.

  • Do you have any Lead Assignment Rules defined? Is there a default Lead Assignment rule under Setup > Customize > Leads > Lead Settings? Apr 5 '16 at 19:59

Thanks Daniel for the response.

The problem is UpdateAsync function has Sforce-Auto-Assign = true which caused the lead owner to be reassigned. This is true for Rest API not Soap.

I am using force.com sdk for C# so there is no way for me to set the header (Sforce-Auto-Assign ) to false.

In my case, I found two solution

  1. Rewrite the sdk. To do this please check this link https://github.com/nmonasterio/Force.com-Toolkit-for-NET/blob/cutom-headers/src/ForceToolkitForNET/IForceClient.cs
    This adds the option to call CreateAsync and pass additional headers with the request.

  2. Add another rule to the rules assignment object to handle this case. So it should look like this

criteria = Current User: 18 Digit User xxxxxxxxxxxxxx assign to = Same User

The above rule dictate when user X updates the lead records, the lead owner must not change.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.