+ Start a Discussion
HaroldHHaroldH 

convertLead() returns an error, but converts the lead anyway

Scenario:

"User A" creates a Lead; Lead owner is User A.
"User B" attempts to convert the Lead via the API.

User A is profile: system administrator, role: higher in the hierarchy
User B is profile: standard user, role: lower in the hierarchy

Result:

LeadConvertResult[0].success = false
LeadConvertResult[0].errors[0] = "insufficient access rights on cross-reference id"

...But the lead was actually converted!

Also, the LeadConvertResult does not return the newly created OpportunityId and ContactId, even though these records have been created.

Message Edited by HaroldH on 06-30-2005 06:29 PM

HaroldHHaroldH
I solved my own problem.

The reason this error appeared is because I wasn't setting the ownerId property of the LeadConvert object. By default, this value is set to the owner of the Lead.

To prevent this error, specify the currently logged in user as the owner of the newly created Account, Contact, and Opportunity, by setting the ownerId property to the current userId.

Message Edited by HaroldH on 06-30-2005 06:32 PM