You are here:
Design a Flow to Update Order Discounts (Example)
Design a flow that allows the decision table to evaluate all the Order records that don’t have a discount. The flow also updates the evaluated Order records with the discount percentage determined by the decision table.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, and Unlimited Editions with Loyalty Management or Rebate Management |
| User Permissions Needed | |
|---|---|
| To create a flow: | Manage Flow |
| To invoke a decision table: | Run Decision Tables |
Note Decision tables are also available as part of Business Rules
Engine. If your org has Business Rules Engine enabled, see Decision Tables for Business Rules Engine.
Let’s say your company adds new Product records every week, so you schedule the flow to ensure that a discount percentage is added weekly for the new products.
- From Setup, in the Quick Find box, enter Flows, and then select Flows.
- Click New Flow.
- Select Scheduled-Triggered Flow as the flow type.
-
From Start, click Set Schedule, and then select the timing.
- Start Date: May 16, 2021
- Set Time: 12:00 AM
- Frequency: Weekly
Then click Done. This setting ensures that the flow runs every week.
-
Drag the Get Records element to the canvas, and then select these attributes.
- Name: Get Order Records
- Object: Order
- Filter Product Records:
- Condition Requirements: All Conditions Are Met (AND)
- Field: Discount
- Operator: Is Null
- Value: True
- How Many Records to Store: All records
-
Then click Done.
-
Drag the Loop element onto the canvas, and then select these attributes.
- Name: Loop All Order Records
- Collection Variable: {!Get_Order_Records}
- Direction: First item to last item
- Click Done.
-
Drag the Get Records element onto the canvas, and then select these attributes.
- Name: Get Order Product Records
- Object: Order Product
- Filter Product Records:
- Condition Requirements: All Conditions Are Met (AND)
- Field: OrderId
- Operator: Equals
- Value: {!Loop_All_Order_Records.Id}
- How Many Records to Store: Only the first record
-
Then click Done.
-
Drag the Get Records element onto the canvas, and then select these attributes.
- Name: Get Product Records
- Object: Product
- Filter Product Records:
- Condition Requirements: All Conditions Are Met (AND)
- Field: Id
- Operator: Equals
- Value: {!Get_Order_Product_Records.Product2Id}
- How Many Records to Store: Only the first record
-
Then click Done.
-
Drag the Action element onto the canvas, and then select these attributes.
- Select Decision Table as Category.
-
Search and select the Decide Discount Percentage for Orders - Evaluate Order
and Product Field Values decision table action.
Select the decision table action that allows the decision table to provide outcomes for the values of the fields specified in the dataset link.
- Enter the name Evaluate Order Records.
- In the Order field, enter {!Loop_All_Order_Records}.
-
In the Product field, enter {!Get_Product_Records}.
- Click Done.
-
Drag the Update Records element onto the canvas, and then select these attributes.
- Name: Update Order Records
- How to Find Records to Update and Set Their Values: Specify conditions to identify records, and set fields individually
- Object: Order
- Filter Product Records:
- Condition Requirements: All Conditions Are Met (AND)
- Field: Id
- Operator: Equals
- Value: {!Loop_All_Order_Records.Id}
- Set Field Values for the Product Records:
- Field:Discount__c
- Value: {!Evaluate_Order_Records.singleOutcome.Discount__c}
- Click Done.
-
Connect all the elements: Get Order Records | Loop All Order Records | Get Order Product Records | Get Product Records | Evaluate Order Records | Update Order Records | Loop All Order Records.
-
Save your work, and then complete these fields.
- Flow Name: Provide Discount Percentage for Order
- Flow API Name: Provide_Discount_Percentage_for_Order
- Activate the flow.
Example Here are the discount percentages that the decision table provides for Order
records.

Hjalp denne artikkelen med å løse problemet ditt?
La oss få vite det slik at vi kan forbedre!

