0

How do I add a product to an opportunity in a Record Triggered Flow After Save?

In my Element, Create Records, on the Opportunity Object, I believe the field Pricebook2Id has to be relevant, though I'm not sure.

Thanks for any help.

manual method to add Product

area in Flow to add Product

2 Answers 2

0

So

  1. Yes, Opportunity.Pricebook2Id is required. Your flow will need to do a Get Records on Pricebook2 to locate the ID of the desired pricebook (often, this is the standard Pricebook)

  2. When you construct the Opportunity product (OpportunityLineItem) you will need a value for the PricebookEntryId. This too will need querying for with a Get Records. PricebookEntry is a junction record between PriceBook2 and Product2. If you are adding 2+ Opportunity Products, you'll need to query for all of the PricebookEntry's, one for each Opportunity product

  3. In the event you are a multi-currency org, you will need to further refine the query for PricebookEntry as there is a separate record for each combination of CurrencyIsoCode : Product2Id : Pricebook2Id

2
0

If you have Apex and run test code to deploy, any test code making a Product2 will fail as the Get Records in your Flow will not return any Pricebook2 (including Standard). Then creating your PricebookEntries will fail as you could not set their Pricebook2Id field.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .