Product Groups with Salesforce Flow
Recently we encountered a customer who sold almost all of their products in groups or bundles. The use case was that each product could be sold individually or within a predefined group that included multiple product line items. This functionality is not included in the Salesforce Sales Cloud. However, with some creative declarative development (no code), it can be done. The user experience is straightforward. On an Opportunity, the user adds a standard Salesforce product that represents the group. Upon save, the user immediately sees all of the products from the group automatically added to the Opportunity.
Magic? Actually, it’s a Salesforce Flow that leverages a couple of custom objects designed specifically to set up the Product Group and then creates the Opportunity Line Items using the data from the custom object records.
What it looks like
- 1) Record Lookup
- 2) Record Lookup
- 3) Fast Lookup
- 4) Loop
- 5) Record Lookup
- 6) Assignment
- 7) Assignment
- 8) Fast Create
Element 1: Lookup the Opportunity Line Item that is kicking off the Flow and grab the Pricebook Entry ID, the Product Group ID and the Product Group Quantity and store them in variables.
Element 2: In the second lookup, we use the Pricebook Entry from the Id stored in the variable collected at the start and grab the Pricebook Id and store it in a variable.
Element 3: Using the Id stored in a variable from the start, Fast Lookup the Group Line Items from the Product Group record to create a collection variable. This step stores the Product ID, the Quantity and Price from each Group Line Item record related to the Product Group.
Element 4: This is the loop that cycles through the Group Line Item collection variable and assigns Opportunity Line Item records to a SObject variable.
Element 5: This record lookup grabs the specific Pricebook Entry Id for each Line Item comparing the Product ID from the Group Line Item in the collection and the Pricebook ID stored from Step One.
Element 6: Now we build the Opportunity Line Items by assigning the fields identified in the Variable Collection for the Opportunity Line Item with Variables collected in the prior steps. This sets the Pricebook Entry ID from Element 5, Quantity and Price from Element 3 and the Opportunity ID from the beginning of the Flow.
Element 7: This step assigns the records created in the prior step to a new SObject Collection Variable.
Element 8: This step creates the Opportunity Line Item records using the SObject Collection Variable from Step Seven.
Custom Object: Product Group
Custom Object: Product Group Line Items
The User Experience
The user edits the products
Note: We’re leaving the price at $0 because the Product Group Line Items dictate the Price and Quantity for each individual item in the Group. You can configure it the opposite way where the Group Line Item records have no price and the Product that represents the group has the Price. Also the Quantity here will affect the quantity of the line items added. If you put two of this product, each line item quantity will double. Since this is a 2 Diesel product group there are two Diesel Generators in the group. If a user selects this Product and changes the Quantity to 2, then 4 Diesel Generators will be added to the Opportunity.
801 10th Street – 5th Floor Modesto,California