+ Start a Discussion
Frédéric RonteixFrédéric Ronteix 

Creating custom contact fields with latest and next won opportunity (Without Rollup!) ?

Dear all,

I am quite new with Apex and have some trouble with programming two custom fields.

Our Salesforce objects have been reprogrammed by specialized company with whom we are no longer in contact with. And with the reprogramming, Contact an Opportunity no longer have a master detail relationship (so rollups do not work!). However I would like to have 2 custom fields on contact  object: the latest won opportunituty and nex won opportunity. How could I do that? process builder? or Apex? and how? 

Thank you all for your help ! 


Develop a trigger on opportunity object to achieve this. Process Builder is not the best for this request.
Magulan Duraipandian
Frédéric RonteixFrédéric Ronteix
Thank you ! Would you have any idea of what this trigger would look like? 
AbhishekAbhishek (Salesforce Developers) 

The below blogs might answer your query,



It has a code snippet too you can modify based on your requirement.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Frédéric RonteixFrédéric Ronteix
Thank you I will take a look !