Auto-generate multiple lines of Opportunity product using flow #inSalesforce

Auto-generate multiple lines of Opportunity product using flow #inSalesforce


Create a custom field (linesToBeCreated) of Opportunity Product to allow user to fill the number of lines to create (default you may set to 1)

In the Opportunity product layout, add this new field

Create a record triggered flow on create of Opportunity Product, criteria - linesToBeCreated greater than 1

Create counter variable with default value record.linesToBeCreated and datatype number

Create variable record type - Opportunity Product varOpptyProduct

Create variable record type (allow multiple values) - Opportunity Product varOpptyProductCollection

Assignment Element:

varOpptyProduct.pricebookentryId equals record.pricebookentryId

varOpptyProduct.SalesPrice equals record.SalesPrice

varOpptyProduct.OpportunityId equals record.OpportunityId

varOpptyProduct.Quantity equals record.Quantity

Decision:

Criteria: Counter > 1

Yes, 

Assignment:

varOpptyProduct.Date equals TODAY()

Assignment:

Counter subtract 1

varOpptyProductCollection Add varOpptyProduct

Criteria: Counter <= 1

Update Element: to reset lines

specify...

Opportunity Product

Criteria: Id equals record.lineItemId

linesToBeCreated 1

Create Record:

multiple: varOpptyProductCollection




Comments