You need to sign in to do that
Don't have an account?
msimonds
Field Integrity exception on Opportunity Line Item Creation
I was wondering if anyone has come across this API return message:
[message] => field integrity exception: PricebookEntryId, unknown (versions 3.0 and higher must specify pricebook entry id; others must specify product id)
I have not seen this, but I do understand what is asking. The reason why I am posting this is because:
How are we supposed to know what the version is when we are creating an opportunity line item?
If somone could please share that with me, I will be greatful
Thanks,
~Mike
This is the message that occurs if you attempt to add an opp line item to an opp that has no price book selected.
so, my guess is the pricebook entry is null in your insert.
Even I'm hitting the same issue. I have checked the Opportunity and there is an Price Book listed to that.
I'm passing the PricebookentryId which is active and the Product is also active. Not sure what else I need to look into.
Any help is highly appreciated. This is quite urgent as well.
-Mahesh
I figured out the issue, if the product status is inactive (i.e. Active checkbox is not checked) then this error would occur.
-Mahesh.
Hi,
I changed the item from inactive to active and I still receive the following message:
Version:0.9StartHTML:-1EndHTML:-1StartFragment:0000000111EndFragment:0000000436
field integrity exception: PricebookEntryId, unknown (versions 3.0 and higher must specify pricebook entry id; others must specify product id).
I have seen this in past but do not recollect it now... I think this error occurs when there is no standard price for the product and you are trying to upsert the lineitem
could someone please post the solution for this?
This error usually pops up when you try to insert wrong value to some field or (even) correct value to the inactive record. I too got this error while writing the test class for a trigger. In my case, It would be better to check the debug log before assuming any cause for this error.
HI All,
Two year down the line this still seems to be an issue,
All knowledge articles encountered aren't giving much insight.
Dose someone know how to get the relevant ProductEntry ID,
In this case my product is active, yet I am getting the same error message.
I think I would already be happy with guidance on how to generate the Pricebook entry ID...
there is one post I found but hits shows only partially how to do it..
see below:
Can someone advise on how to get the PricebookEntryID?
Step 4 (optional)
INSERT products into "OpportunitiesLineItem" Table
1. Data Columns:
-Opportunity ID
-PricebookEntryID
-Total Price
-Quantity
-Unit price
-other fields as needed
NOTE: The Opportunity Product Table provides the "ProductID" as a mappable field, however this field should not be mapped in this process.
1. Export the Opportunity Product (OpportunityLineItem) table for a template
2. Export the appropriate Opportunities from the data loader with filter criteria.
3. Copy OpportunityID into the insert/update template file.
4. Export the "Price Book Entry" table from the data loader, the "ID" column is the PricebookEntryID.
5. Copy the appropriate PricebookEntryID's (with corresponding Opportunities) into the insert/update file.
6. Add the other data into the relevant columns in the insert/update file.
7. Open AppExchange Data Loader.
8. Insert to "Opportunity Product (OpportunityLineItem)" table
_______________________________________________________________________________________________
NOTES:
- The PricebookEntryID used in the insert file must correspond to the Opportunity Price Book that has been selected in the application.
- If you change the Product Family as a part of the update process, be sure to change the picklist values for this standard field as well.
- When loading new products and Price Books, pay particular attention to the sequence of steps detailed above. The user defined standard Price Book must contain all products before the products can be assigned to other Price Books.
ADDITIONAL REFERENCE:
1. Use Link: http://www.sforce.com/us/docs/sforce60/wwhelp/wwhimpl/js/html/wwhelp.htm
2. From the Table of Contents | Entity Relationships Diagrams | Product and Schedule objectspdf
How can you view the Opportunity Line Item ID and the Pricebook ID on an Opportunity with Product report?
https://help.salesforce.com/apex/HTViewSolution?urlname=How-can-you-view-the-Opportunity-Line-Item-ID-and-the-Pricebook-ID-on-an-Opportunity-with-Product-report-1327109401509&language=en_US
- OpportunityId
- PricebookEntryId
- Quantity
- TotalPrice
Please note that I had already assigned a pricebook to the opportunity. Yet, for some reason or another it required me to manually calculate the "TotalPrice" in order to save the line item.For me it was a pretty obvious problem in the end... I ended up passing on a string instead of an ID to the PricebookEntryId field... I'd rather have suspected an "INVALID_TYPE" kind of error instead of this one. But Salesforce is not the best at error messages ;)
and that Pricebook (Opportunity.Pricebook2Id) has been selected on the Opportunity to which you are adding the OpportunityLineItem
<-- even though it's obvious in hindsight.
Thanks. Thumbs up.
IT Main One
You will get this error if the if the Product (OpportunityLineItem.Product2Id) referenced in the OpportunityLineItem has not been added to a Pricebook
Earlier my code was like this:
OpportunityLineItem cartRecord = new OpportunityLineItem();
cartRecord.OpportunityId = opp.id;
cartRecord.Product2Id = prod.id;
cartRecord.PricebookEntryId = pbe.id;
cartRecord.UnitPrice = 34;
cartRecord.Quantity = 221;
And then I resolve my issue with this code:
OpportunityLineItem cartRecord = new OpportunityLineItem();
cartRecord.OpportunityId = opp.id;
cartRecord.Product2Id = prod.id;
cartRecord.PricebookEntryId = pbe.id;
cartRecord.UnitPrice = pbe.UnitPrice;
cartRecord.Quantity = 221;
List<PricebookEntry> pbe = [select id, name, CurrencyIsoCode from PriceBookEntry where Pricebook2id =: 'VALUE' and Product2Id in: VALUE.keySet() ];
Knowledge article link: https://help.salesforce.com/s/articleView?id=000317297&type=1 (https://help.salesforce.com/s/articleView?id=000317297&type=1)