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
Dan Cline 1Dan Cline 1 

Roll up from Opportunity Product page to the Opportunity Page

Hi all-

I am trying to roll up the Product Name from the Opportunity Product page to the Opportunity page. I've been told this is only possible via apex trigger or coding. Has anyone accomplished this? If so, please share screen shots or anything you can to help me! 

ps. i've never created apex triggers or done coding.

Thanks!
NagendraNagendra (Salesforce Developers) 
Hi Dan,

May I suggest you please refer to below link from the forums community with a similar discussion which might help you further. Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
v varaprasadv varaprasad
Hi Dan,

You need write triiger on OpportunityLineItem object.

Sample trigger : 
 
trigger AddProductnamesonOpportunity on OpportunityLineItem(after insert, after update, after delete, after undelete) {
    if (trigger.isAfter && (trigger.isInsert || trigger.isUpdate || trigger.isUndelete)) {
        SampleRollupSummary.rollupProducts(trigger.new);
    }
    else if (trigger.isAfter && trigger.isDelete) {
        SampleRollupSummary.rollupProducts(trigger.old);
    }
}
 
public class SampleRollupSummary {
  
    public static void rollupProducts(list<OpportunityLineItem> lstOfopps){

   // Here you need all the code to update opportunity.

}
}


Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.


Thanks
Varaprasad
Salesforce Freelance Consultant/Developer/Administrator
@For Salesforce Project Support: varaprasad4sfdc@gmail.com


Salesforce latest interview questions  :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1

 
Dushyant SonwarDushyant Sonwar
Hi Dan,

If you have never written trigger , i would suggest you to go through the below urls:
This will give you a brief idea about writing apex trigger.

http://www.sfdc99.com/beginner-tutorials/
http://www.sfdc99.com/2014/04/06/example-how-to-write-an-advanced-trigger/

Best of Luck !