3

I am converting a Lead to Person Account using Apex but it is throwing the exception as given below:

ConvertLead failed. First exception on row 0; first error: UNAVAILABLE_RECORDTYPE_EXCEPTION, Unable to find default record type: []

How do I solve this problem? I enabled all RecordType permissions on the Profile but still I am getting the same error.

Code:

Database.LeadConvert[] leadsToConvert =new Database.LeadConvert[0];
Database.LeadConvert lc = new Database.LeadConvert();
lc.setAccountId(acc.id);
lc.setLeadId(l.Id);
lc.setConvertedStatus('Closed - Converted');
lc.setDoNotCreateOpportunity(true);
leadsToConvert.add(lc);
Database.LeadConvertResult[] results= Database.convertLead(leadsToConvert,true);
2

I solved this problem. I am using force.com site profile so I enabled RecordType and CRUD permissions for Account and Contact.

  • I just had a similar issue, however I got stuck on looking at the user that was triggering the process, not the owner of the record. Make sure the owner has the right record type settings. BTW, you should probably mark this as the correct answer. – Nick Cook Mar 10 '16 at 0:13

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.