When i am converting lead via apex, i get an error Invalid ConvertedStatus.

  1. I have made sure that the Lead Status has correct converted status.
  2. Also the status is Active
  3. We have recordtypes set on Lead. Also made sure that the lead status values are accessible for the processes.

The regular lead convert from UI works, somehow its the code which fails

The code is part of managed package, which works on a few orgs, but is failing on one org.

Is there any other setting that i might be missing out which could be causing the error.

          lc.setConvertedStatus(CStatus); // CStatus has the correct status
                        if(leads.Company == null)
          lcrs = Database.convertLead(lcs, false);

for(Database.LeadConvertResult lcr : lcrs) {
                System.debug( 'processing a lead convert result');
                if(!lcr.isSuccess()) {
                    System.debug(System.LoggingLevel.ERROR, 'lead conversion failed for lead with id: ' + lcr.getLeadId());
                    //Lead l = newLeads.get(lcr.getLeadId());
                    error = true;

                    for(Database.Error dbe : lcr.getErrors()) {
                        System.debug(System.LoggingLevel.ERROR, dbe.getMessage());
                        Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'There was an error converting this Lead. ' + dbe.getmessage()));
                        return null;


Looking at documentation here https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_convertlead.htm Can some help me understand what this means. It refers to lead source on the lead record or on opp?

Record types: If the organization uses record types, the default record type of the new owner is assigned to records created during lead conversion. The default record type of the user converting the lead determines the lead source values available during conversion. If the desired lead source values are not available, add the values to the default record type of the user converting the lead.

  • Have you seen this similar question? Seems like it could be what you are looking for. Sep 11, 2017 at 17:55
  • @ZackWalton I did see that thread. i just updated the question
    – Prady
    Sep 11, 2017 at 18:03

4 Answers 4


The issue turned out to be that the API name of converted Status was different to MasterLabel. And i was passing the masterlabel on the code which was causing the issue .

Now i changed the api name to be same as the master label and code works fine. Is it better to pass the API name of lead status OR use the Master Label? My gut feeling is to use the API name.

  • 1
    I had the same problem with the MasterLabel not matching the ApiName. So, I just changed the lead status query: LeadStatus ConvertStatus = [ SELECT Id, ApiName FROM LeadStatus WHERE IsConverted = TRUE LIMIT 1 ]; Dec 7, 2017 at 19:36

According to your updated question, during conversion system will look for Lead Source of the Lead object.

The user who is converting the Lead must have valid recordtype assginment and the Lead Source should be assigned to the user's profile who is converting the Lead.

The default record type of the user converting the lead determines the lead source values available during conversion. If the desired lead source values are not available, add the values to the default record type of the user converting the lead.

For example, Lead's recordtype is Marketing Lead and Lead source is Campaign. Now the user who is converting the lead has separate recordype assigned to his profile where Campaign lead source doesn't exist then, system will throw that error.


This error is due to either:

  1. Not having an active Lead Process defined in Salesforce associated with your Lead record types

  2. Having a Lead Process defined but not having the specific Lead Status noted in the logfile associated with that Lead Process

  3. Not associating the Lead Process that includes the noted status (Like examples "Contacted" or "Qualified" with the record type of the Leads that are selected for conversion

The Lead Process is needed to define valid picklist values for Lead Statuses that can be used with specific Lead record types.

  • All these conditions were met and still throws the error
    – Prady
    Sep 12, 2017 at 14:45
  • Maybe can you explain point 2. Where can i find the logfile?
    – Prady
    Sep 12, 2017 at 14:46

You can set the users record type by:

Setup | Manage users | Profiles | Select a profile | Object Settings | Leads (or whichever object) | Edit| Select from the list of record types- default is the column on the Right.

  • Ah.. Thanks.. But thats also been set up correct. Its using the same recordtype as default which i am trying to convert and is the selected as Selected Recordtype
    – Prady
    Sep 11, 2017 at 18:14
  • Does that Lead RecordType have a Lead Process? Sep 11, 2017 at 18:18
  • Yes, it does have Lead Process
    – Prady
    Sep 11, 2017 at 18:24
  • Darn. Im just trying everything here but have you selected a "converted status" value for the record to be converted? Sep 11, 2017 at 18:33
  • Yes, i do have one Converted Status Value selected and i am passing that status while converting the lead
    – Prady
    Sep 11, 2017 at 18:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .