[SalesForce] FIELD_INTEGRITY_EXCEPTION when creating Price Book Entry from flow

I have created a flow that creates a pricebook entry for new products (based on a custom field on the Product object), however when I debug the flow it comes up with the following quite generic error:

FIELD_INTEGRITY_EXCEPTION: field integrity exception.

I cannot work out what I am doing wrong. I have reduced the flow to three steps:

  1. Start
  2. Assignment: recNewPriceBookEntry
  3. CreateRecord (base on reNewPriceBookEntry)

The full output of the final step that causes the error is:

FAST CREATE: Create_New_Price_Book_Entry

Create PricebookEntry records using the values that are stored in {!recNewPriceBookEntry}.

Variable Values

[IsActive=true,Product2Id=01t25000003Hfy8,UnitPrice=1200,UseStandardPrice=true,Pricebook2Id=01s58000001nQb8]

Result

Failed to create records.

Error Occurred: This error occurred when the flow tried to create records: FIELD_INTEGRITY_EXCEPTION: field integrity exception.

I have also tried using the 18 character IDs (01t25000003Hfy8AAC & 01s58000001nQb8AAE), which results in the same error.

As this is a fresh sandbox, there are no entries in the Price Book Entry object (I double checked that with Developer Workbench).

If anyone can tell me what I am doing wrong that would be very much appreciated.

Best Answer

Rohit Patil's comment solved the problem:

UseStandardPrice field value can not be set to true on insert.

I removed the UseStandardPrice field from recNewPriceBookEntry and it started working.

Thank you.

Related Topic