You need to sign in to do that
Don't have an account?

Database.ConvertLead() not working
Hello,
I amhaving trouble with the lead conversion call. The call to Database.ConvertLead does not seem to be working. It claims that the LeadStatus is not correct - but if you look in the Lead Processes, this status is in fact the converted status for that record type. AND you can also query the LeadStatus table:
Select l.MasterLabel, l.IsConverted, l.Id From LeadStatus l and see that 'Accepted' is in there with isConverted = true. I even did a select on that value as the MasterLabel to make sure that thre wasn't some odd whitespace issue.
System.DmlException: ConvertLead failed. First exception on row 0; first error: INVALID_STATUS, invalid convertedStatus: Accepted
I have tried all 4 lead statuses which are conversion endpoints and none works.
Any ideas are much appreciated!
Thanks,
Sara
Message Edited by sarac on 12-01-2008 06:41 PM
I amhaving trouble with the lead conversion call. The call to Database.ConvertLead does not seem to be working. It claims that the LeadStatus is not correct - but if you look in the Lead Processes, this status is in fact the converted status for that record type. AND you can also query the LeadStatus table:
Select l.MasterLabel, l.IsConverted, l.Id From LeadStatus l and see that 'Accepted' is in there with isConverted = true. I even did a select on that value as the MasterLabel to make sure that thre wasn't some odd whitespace issue.
System.DmlException: ConvertLead failed. First exception on row 0; first error: INVALID_STATUS, invalid convertedStatus: Accepted
I have tried all 4 lead statuses which are conversion endpoints and none works.
Any ideas are much appreciated!
Thanks,
Sara
Message Edited by sarac on 12-01-2008 06:41 PM
Well, we're not actually having the lead conversion create any objects - I am creating the Account and Contact (or finding exisitng records) and populating them prior to that call. Two other custom objects are created as well (no opportunities in one case, 3 in another). We are just calling convertLead to set the isConverted flag on the Lead since it is not accessible via the API. I would think the validation rule would fire and throw any errors on insert of the new objects prior to causing an issue in the convertLead call?
To answer your question: there are no validation rules on Account, it fails in the call when no opportunities are created, so I will assume any rules on that object are irrelevant, and there is one rule on the Contact - that email can't be null. At least in the unit tests, Email is not null.
Thanks,
Sara
All Answers
Well, we're not actually having the lead conversion create any objects - I am creating the Account and Contact (or finding exisitng records) and populating them prior to that call. Two other custom objects are created as well (no opportunities in one case, 3 in another). We are just calling convertLead to set the isConverted flag on the Lead since it is not accessible via the API. I would think the validation rule would fire and throw any errors on insert of the new objects prior to causing an issue in the convertLead call?
To answer your question: there are no validation rules on Account, it fails in the call when no opportunities are created, so I will assume any rules on that object are irrelevant, and there is one rule on the Contact - that email can't be null. At least in the unit tests, Email is not null.
Thanks,
Sara