I am using SalesforceSharp to create an Opportunity. The header is working OK, I have ensured that the CurrencyIsoCode
and PriceBook2Id
fields are set.
When trying to create the Opportunity Line Item, I am getting the error message below:
field integrity exception: PricebookEntryId, unknown (versions 3.0 and higher must specify pricebook entry id, others must specify product id)
When creating the object I am passing in the OpportunityId
, PriceBookEntryId
, and Quantity
. I have tried various combinations of using Product2Id
, and also using Product Code
and Total Price
.
I have checked that the Opportunity has a valid Price Book connected, and can create the item manually.
If I change to pass the Product2Id
in, I get a different error message:
field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code)
I have four entries in my Price Book for the same product with different currencies. I have found that if I select them using the Developer Console, the JPY entry is first. And looking at a validation rule in the Logs I can see that it indeed is finding the JPY entry.
Questions:
- Approach 1, when it is referring to v3 - v3 of what?
- Approach 2, what field am I missing on the Opportunity Line for it to find the correct PriceBook entry?
SalesforceClient.ApiVersion
?