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
Tashika GuptaTashika Gupta 

when opportunity product is added to opportunity

i have a custom feilds called product codes on opportunity.Whenever opportunity product is added to Opportunity,'Product Codes' field value should be appended with the product code of that opportunity product. 

how to implement this through triggers,please help me out
Guy KeshetGuy Keshet
sounds a stange solution to me - what happens if your customer adds multiple opportuntiy products?!?

as for your question - you simply write a trigger on the opportuntiy product object ...
but you dont need code for this, you could use a rollup summary field
If you have more than one line item which product code you need to display it that field?

else you have trigger on Opporunity Lineitem object , which will fire while inserting and will show all line items code in opportunity as Comma seperate.