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
JBabuJBabu 

"FIELD_INTEGRITY_EXCEPTION, Price Book Entry ID: id value of incorrect type

Hi,

 

Even though id values are same for pricebook2 id of opportunity and pricebookentry id for opportunity line item. I have verified both the ids by putting debug statements also.

Even I checked the status they are active as I am explicitly inserting isActive=true for test data records.

 

It is strange to know I a getting the below issue:

 "FIELD_INTEGRITY_EXCEPTION, Price Book Entry ID: id value of incorrect type".

 

Can some one please help on this issue?

 

Thanks,

JBabu.

 

ShamilShamil

JBabu,

 

The exception says that your price book entry (PriceBookEntry object) id is invalid. Make sure you're not passing price book (Pricebook2 object) id as a price book entry id.

PriceBookEntry ID prefix is 01u - make sure your id starts with 01u

Pricebook2 ID prefix is 01s

imranrazaimranraza

JBabu,

                  When you are creating Opportunity Line Item set price of Line Item = PricebookEntry.UnitPrice.

                  This will remove the exception.

Thanks

Imran

 

Ken LingKen Ling
Where I can manually getting PricebookEntryId
gopikumar7gopikumar7
@Ken Ling,

You can use below SOQL to get the PricebookEntryId
SELECT Id, Name, Pricebook2Id, Product2Id FROM PricebookEntry

 
gopikumar7gopikumar7
@Ken,

For more specific results, use Pricebook2Id, Product2Id in where condition on above SOQL query.