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
ndganindgani 

Syncing Custom Fields between QuoteLineItem and OpportunityLineItem

Hello All

 

I need to get the Custom Fields i have in QuoteLineItem and OpportunityLineItem

to sync between a synced Opportunity and Quote.

 

I understand that there is no automated process to do this at the moment and

i want to do it manually (Via trigger).

 

The problem i am facing is knowing which line item in the Opportunity/Quote is the corresponding line item of

a specific line item in the Quote/Opportunity.

 

I'm guessing there is some field that salesforce uses when syncing standard fields but because

there is no schema yet, i dont know.

 

when answering, please consider that PricebookEntryId and ProductCode are not a solution because

the scenarios include one where the same product is entered twice with different Custom fields values.

 

Thanks 

 

 

DEV_NAVATARDEV_NAVATAR

You will get Opportunity Id from Quote Line Item from QuoteLineItem.Quote.Opportunity.Id or QuoteLineItem .Quote.OpportunityId. Then you can check for Opportunity Line Item with this Opportunity Id.


To get synchronized quote id from Opportunity Line Item use Opportunity.SyncedQuote.Id or Opportunity.SyncedQuoteId and you can check for Opportunity Line Item with this Quote Id.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

ndganindgani

Hi Dev_Navatar

 

Problem is actually not related to the header level (Opportunityy/Quote).

 

your proposed solution allows me to get the opportunity synced with the quote with which the line item is affiliated.

and you are right, i can use quote.OpportunityId or Opportunity.SyncedQuoteId going the other way.

 

but,

 

my problem is different.

I need to know the synced line item.

Example:

if i have a quote line item for product X, I would want to get the Opportunity line item for Product X.

 

and that can be done by the product lookup in the line item or part number in the product.

The problematic part is what if you have the same product twice?

if you were to rely on the product lookup or part number you wouldn't be able to match the line items correctly.

HarmpieHarmpie

Salesforce labs published and app on the appexchange to facilitate this: https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000003IlfVEAS

Amit Chaudhary 8Amit Chaudhary 8
I have created a blog for this issue Please check below link :- 
http://amitsalesforce.blogspot.in/2014/11/syncing-custom-fields-between-quotes.html

Please like this post if above link is helpful 

Thanks
Amit Chaudhary