function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eli Flores, SFDC DevEli Flores, SFDC Dev 

Formula to get information from Opportunity in a converted Lead

I'm trying to create a formula field on Leads to show what stage a lead is in our sales lifecycle. It's all going smoothly until I try to determine if the associated opportunity is Won. I just can seem to figure out the proper method to pull it into the lead.

 

The standard formula field edit on leads will give me the ConvertedOpportunityID but it doesn't  allow me to access any information from the opportunity

 

I tried using a custom lookup  field  + a trigger but the trigger on the lead to populate the custom field but since the ConvertedOpportunityID is populated on conversaion, it's not accessible from before update trigger  and you can't use the after update option since the record at that point is locked.

 

Anyone have any success along these lines

 

Shashikant SharmaShashikant Sharma
You have to develop trigger on Lead Object After Update to populate the lookup field. Check if 

if( lead.IsConverted == true && trigger.oldMap(lead.Id).IsConverted == false ) {
 
//here you could get ConvertedOpportunityId and make list of oppotunity which needs to populated with lookup field

}

If you still have issues let me know. 

Please mark this as aswer if it resolve the issue so it could help others.