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
kim.stiteskim.stites 

Opportunity LineItem Integration

I am integrating my ERP with Salesforce and we have all of our products loaded and active in Salesforce but how can I take the product code and attach it to the opportunity.  The pricebook entryid table is empty.

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

If you're coding this yourself, you can do:

 

 

select id,product2.productcode from pricebookentry where product2.productcode in ('Code 1','Code 2','Code 3') and pricebook2.isstandard = true

... Other similar mechanisms would probably work, too. This is just for example. Once you have PricebookEntry.ID, you can proceed with inserting your OpportunityLineItem records.

 

All Answers

sfdcfoxsfdcfox

You have to migrate the PricebookEntry values. This is what determines the default dollar amount for a product (because the same product might cost differently depending on whom you are selling to, pricing matrix, etc). If you have only one price, use the Standard Pricebook (select id from pricebook2 where isstandard = true). You can use zero to suggest to the user that they need to enter a price.

kim.stiteskim.stites

My question is how to take the product code field from the product as these are what are used in our ERP and then get the pricebookentryid so I can add the lineitem to the opportunity.

sfdcfoxsfdcfox

If you're coding this yourself, you can do:

 

 

select id,product2.productcode from pricebookentry where product2.productcode in ('Code 1','Code 2','Code 3') and pricebook2.isstandard = true

... Other similar mechanisms would probably work, too. This is just for example. Once you have PricebookEntry.ID, you can proceed with inserting your OpportunityLineItem records.

 

This was selected as the best answer