+ Start a Discussion
Sunil NandipatiSunil Nandipati 

Create Opportunity Lines after Lead Conversion

Running into tricky situations with Lead conversion.
My business case:  (1) Auto create Opportunity Lines from a prodcuts multi-select picklist on the Lead and (2) link the lead related records on the custom object (lookup relationship) to the newly created Opportunity and related Account (look ups again)

Having an Trigger on Lead After update - Checking if the record is marked as "Converted" and performing
- Line Items creation on Opportunities
- Linking the custom object to the newly created Opportunity and related Account

However the behavior we are noticing is, the opportunity lines are creating multiple times.
1 set for the real code
another sets for each occurence of the custom object link.

Looks like whenever we are trying to link the new opportunity to the custom object, the lead is getting updated (backend lastmodifieddate timestamp change) - and it is re-triggering.

We tried to use a flag, however during conversion and after conversion, lead is read-only and we cannot hv a flag.

Has anyone come across this scenario? how did you solve it? Any suggestions?