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
Robbi ConverseRobbi Converse 

Reference Opportunity Products on Custom Object

I have a custom object "Service Agreement" and need to reference the Opportunity Products on that object when the Service Areement is created from an Opportunity. (It is my understanding that these will update when a quote is synced...please correct me if I am wrong.) The bottom line is that I need the agreed upon products and associated information (price, qty, etc.) on the Service Agreement. My deadline is looming and I just can't figure this out.
Best Answer chosen by Robbi Converse
Tarun J.Tarun J.
Yes, it requires Trigger to fetch values from OpportunityLineItem. You can hand it over to your Developer team.

All Answers

Tarun J.Tarun J.
Hello Robbi,

When you insert a Service Agreement record from opportunity, you get reference to Opportunity Id. You can query on OpportunitylineItems to get the list of products associated with Opportunity. You can update fields on Service Agreement record with product values.

-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Robbi ConverseRobbi Converse
I don't quite understand. When I am creating a field on the service agreement (Service Agreement -> Opportunity), OpportunityLineItems isn't a field option.
Tarun J.Tarun J.
There is no option of OpportunityLineItem type on field creation. OpportunityLineItem is an Object.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitylineitem.htm

You need to create custom field on Service Agreement object with the matching data types of OpportunityLineItem. Those fields need to be populated with the values of related OpportunityLineItem record using Trigger on creation of Service Agreement record.

-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Robbi ConverseRobbi Converse
I cannot find OpportunityLineItem Object anywhere to see what data type it is or to relate it to the Service Agreement. However, there is one word in your answer that concerns me and that is "trigger." I haven't worked with triggers at all. If that is the only way to do this, I will need truly step-by-step instructions or I will have to hand off to a more experienced admin or developer.
Tarun J.Tarun J.
Yes, it requires Trigger to fetch values from OpportunityLineItem. You can hand it over to your Developer team.
This was selected as the best answer