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
Jeff GJeff G 

Creating an Opportunity Line Item in Flow

Hi all,

I am having trouble creating an Opportunity Product (i.e. Opportunity Line Item) using the flow designer.

My main issue right now is retrieving the price: I want to use a certain price book entry associated with a particular product type, but I don't know how to access the price book entry ID.

I've tried hardcoding the entry id that I copied from their respective URL's, but this is the error I get when I try running the flow:

UPSERT --- UPSERT FAILED ---  ERRORS :  (FIELD_INTEGRITY_EXCEPTION) Price Book Entry ID: id value of incorrect type: 01tG0000009zqGbIAI ---  for SFDC record with ID : null, 

I copied and pasted the "01tG0000009zqGb" portion into the flow, but does anyone know what the "IAI" suffix means and what is it for?

Any suggestions would be great!

Best Answer chosen by Jeff G
James LoghryJames Loghry
The error is pretty self explanatory.  You are giving it a Product2 Id rather than the pricebook entry id.  The Opportunity Line Item needs the PB Entry Id so that it can pull in pricing information.  Note, here is a list of the Id prefixes and what the mean:

The reason you're seeing the extra IAI characters is that the error returns the 18 character or CASESAFEID rather than the 15 character version, but both versions will work, provided they're associated with the correct sObject type.