I have a trigger on events which on receiving data creates leads and then converts it to Opportunity. The problem is the record type is assigned to specific profile level default for the user that is being used as integration user, how can i assign record type for opportunity in the apex code while converting the lead.
1 Answer
This can't be done as part of the leadConvert
method, so you'll have to write separate automation on the Lead object that fires when the lead conversion is complete. You can then reference the ConvertedOpportunityId
field in the Lead to find the opp and change the record type.
See Lead Object documentation for info on IsConverted
and ConvertedOpportunityId
fields.