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.
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.
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?– AdamMay 1, 2014 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.– sfdcfoxMay 1, 2014 at 13:40