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.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communitySo
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)
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
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