Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

The customer's spec requires some standard fields on leads to be mapped to custom fields and vice versa. I've been trying to override the lead conversion behaviour by writing an apex class. Mapping the fields isn't difficult but actually marking the lead as converted in the same way that SF does is proving difficult. I don't want to use the convertLead method because that automatically maps fields to fields I don't want them mapped to.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

No, all successful conversions will use convertLead, either by UI's leadconvert.jsp, API's convertLead, or Apex Code's convertLead. Since you're writing your own code to handle the conversion, simply call convertLead, then call an update on the account to fix the fields that need intervention.

share|improve this answer
    
Can leads I have just converted still be used in the same way as unconverted leads in apex code? Or do I have to query for a different object? –  Adam May 1 at 13:38
    
They are still in the Lead object; the only difference is that ConvertedAccountId, ConvertedOpportunityId, ConvertedContactId, IsConverted, and Status will change. You cannot use 'upsert' or 'update' on those records; only 'delete' and 'undelete' will work. –  sfdcfox May 1 at 13:40
    
Brilliant thanks :) –  Adam May 1 at 13:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.