At the time of this project, when a Quote is created from the Salesforce UI (Classic or Lightning), or the Quote is syncing, and you create an OpportunityLineItem (that is, add an Opportunity Product via the Products related list) then Salesforce automatically copies and syncs the OpportunityLineItem standard fields to the QuoteLineItem standard fields.

Custom fields are ignored.

This project allows you to define via custom setting which OpportunityLineItem custom fields you want copied down to the newly created QuoteLineItem custom fields.

Please note that this project currently does not handle syncing. I explain why in more detail on the project’s FAQ. In short, it’s a really hard problem to get right and not risk data corruption. Users aren’t happy when you corrupt their data.

This solution, openly available on GitHub, uses a Custom Setting to let you configure which fields you want copied from the OpportunityLineItem to the QuoteLineItem. Since standard fields are already handled by Salesforce automatically then you only need to configure custom fields in the custom setting mapping.

In the below screen shots I show an example where I’ve created custom fields on both the OpportunityLineItem and QuoteLineItem named Warranty__c. I use the custom setting to indicate that I want to map the two fields together (conceptually like Lead Field Mapping from Lead to Account).

quote-line-item-field-mapping-custom-setting[1]

On my opportunity, I added two products and populated the Warranty custom field.

opportunity-line-items[1].png

I then created a new quote. Automatically, Salesforce creates QuoteLineItems based on the OpportunityLineItems of the parent opportunity, and it copies all the standard field values. My solution takes this a step further and ensures the custom fields are populated too. Without my trigger then the QuoteLineItem.Warranty__c field would still be blank.

quote-line-items[1]