[SalesForce] Convert Lead to Custom Object, Opportunity and Contact

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)

Best Answer

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.

Related Topic