Prepare Your Org
What You’ll Learn
This flow project introduces you to the Assignment, Decision, Get Records, and Update Records elements. In it, you’ll learn how to:
- Perform conditional branching with more than two branches.
- Pass data from a record into a flow by using URL parameters.
Get Your Org Ready
Sales reps cite Acme Wireless’s aggressive discount program as a key factor in closing deals. Unfortunately, getting permission to offer that discount is cumbersome. Reps must email management, wait for a reply, and then pass the information back to the customer. The process is slow, and it lets Acme’s more nimble competitors land clients being courted by Acme. Streamlining this process is a top priority, and you’ve been called in to assist.
In this project, you create a flow that automatically determines how much of a discount to offer a customer. Here’s how it’ll work when you’re done.
A sales rep gets to the point in her deal where she needs to quote a price to her client. She goes to the opportunity record and clicks a button: Calculate Discount. Bam! The discount is calculated and the opportunity is instantly updated. Thanks to some simple math in the flow, the rep doesn’t have to wait for management to approve the discount. She can get back to her job: closing deals fast.
Notice that the sales rep doesn’t have to do anything other than click a button. That’s because this flow works in the background. Flows that don’t require user interaction are called autolaunched flows.
This project requires your Trailhead Playground to have two custom fields on the Opportunity object. Discount Percentage stores the opportunity’s discount and Discounted Amount calculates and stores the final opportunity amount after the discount has been applied.
- From Setup, enter
Object Manager
in the Quick Find box, then select Opportunity. - Select Fields & Relationships and click New.
- For Data Type, select Percent and then click Next.
- Enter these values.
- For Field Label, enter
Discount Percentage
. - For Length, enter
18
. - For Decimal Places, enter
0
. - For Description, enter
Displays the percentage to be subtracted from the total amount of the opportunity.
- For Help Text, enter
If the customer is getting a discount on this opportunity, enter the amount here. For example, if the discount is 10%, enter the whole number 10.
- For Field Label, enter
- Click Next twice, then Save & New.
If the New Custom Field page doesn’t appear, refresh the page. - For Data Type, select Formula and then click Next.
- Enter these values.
- For Field Label, enter
Discounted Amount
. - For Field Name, enter
Discounted_Amount
. - For Formula Return Type, select Currency.
- For Decimal Places, enter
2
.
- For Field Label, enter
- Click Next.
- Enter these values.
- For Discounted Amount (Currency), enter
Amount * (1 - Discount_Percentage__c)
- For Description, enter
Calculates the opportunity amount after any discount has been applied.
- For Help Text, enter
Opportunity amount after discount has been applied.
- For Discounted Amount (Currency), enter
- Click Next twice, then Save.