I have a requirement to convert lead(a specific record type) to these 3 objects. (A Custom Object, an Opportunity and a Contact) The Custom Object will be the parent of the Opportunity and the Contact.

So what are my options? I want to give the user same experience as they are converting lead now. (By clicking the standard button)

1 Answer 1


You will need to write trigger on lead object. There is a flag field "isConverted" on lead to decide whether it is converted. Write trigger on update event of lead. Compare trigger.old value and trigger.new value of isConverted flag. Then you can insert objects as you want.

  • So the Account record will still be created right? I don't want to Account record to be created. Is it possible?
    – sfdcnoob
    Commented May 13, 2015 at 15:48
  • If it is in trigger, you will have control over what is getting inserted. Even if salesforce is inserting by default, you can delete it from trigger.
    – Victor
    Commented May 13, 2015 at 15:50
  • Victor, does the "contact creation","opportunity creation" and "account creation" happen before lead type change to "Converted"?
    – sfdcnoob
    Commented May 13, 2015 at 18:35
  • I think by after update event, related records will be inserted. If you compare trigger.old and trigger.new in after update event you can find if the lead is converted. Then query Acc/Opp/Contact with Ids obtained from trigger.new.
    – Victor
    Commented May 13, 2015 at 19:38
  • Victor, we are not able to use trigger.new in the after update trigger right?
    – sfdcnoob
    Commented May 13, 2015 at 20:40

You must log in to answer this question.

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