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’ 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.

  1. From Setup, enter Object Manager in the Quick Find box, then select Opportunity.
  2. Select Fields & Relationships and click New.
  3. In the Data Type column, select Percent and then click Next.
  4. Add a Percent field with these values.
    Field Value
    Field Label Discount Percentage
    Length 18
    Decimal Places 0
    Field Name Discount_Percentage
    Description Displays the percentage to be subtracted from the total amount of the opportunity.
    Help Text 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.
  5. Click Next twice, then Save & New.
  6. In the Data Type column, select Formula and then click Next.
  7. Add a Formula field with these values.
    Field Value
    Field Label Discounted Amount
    Field Name Discounted_Amount
    Formula Return Type Currency
    Decimal Places 2
    Click Next to get to the next window.
    Field Value
    Discount Amount (Currency) =
    Amount * (1 - Discount_Percentage__c)
    Description Calculates the opportunity amount after any discount has been applied.
    Help Text Opportunity amount after discount has been applied.
  8. Click Next twice, then Save.