• EmilyM
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I'm getting the following error when attempting to convert a Lead:

System.DmlException: ConvertLead failed. First exception on row 0; first error:
INVALID_STATUS, invalid convertedStatus: Closed - Converted: []

I have determined that this is happening because I have more than one converted LeadStatus.  Different Lead RecordTypes have corresponding Lead Processes associated to them, each one using a different converted LeadStatus.

The code I have to pick LeadStatus is:

LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus  where IsConverted=true limit 1];

Obviously, this just picks the first available converted LeadStatus, which for some RecordTypes is not the appropriate one.

Could someone please point me to a code sample that does a smarter
LeadStatus selection?

 

Also, I'd like to understand why convertLead started failing with this error in the last month or so, since everything else stayed the same.  Someone suggested in the forum that there were several issues after the Spring 12 release.
Thanks!
  • April 07, 2012
  • Like
  • 0
I'm getting the following error when attempting to convert a Lead:

System.DmlException: ConvertLead failed. First exception on row 0; first error:
INVALID_STATUS, invalid convertedStatus: Closed - Converted: []

I have determined that this is happening because I have more than one converted LeadStatus.  Different Lead RecordTypes have corresponding Lead Processes associated to them, each one using a different converted LeadStatus.

The code I have to pick LeadStatus is:

LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus  where IsConverted=true limit 1];

Obviously, this just picks the first available converted LeadStatus, which for some RecordTypes is not the appropriate one.

Could someone please point me to a code sample that does a smarter
LeadStatus selection?

 

Also, I'd like to understand why convertLead started failing with this error in the last month or so, since everything else stayed the same.  Someone suggested in the forum that there were several issues after the Spring 12 release.
Thanks!
  • April 07, 2012
  • Like
  • 0