Skip to main content

Add an Action to Update the Opportunity

Update the Opportunity with the Discount and Finish the Flow

Once the flow has determined which discount to apply, it needs to return that information back to the opportunity so that the sales rep knows how much of a discount to offer the customer. Let’s update the opportunity with the value of the discount variable by using an Update Records element.

In an Update Records element, the flow takes two actions. First, it looks up one or more Salesforce records by using criteria. Second, it updates one or more of the record’s fields. The Update Records element updates every record that meets the criteria.

Here, the flow finds an opportunity record whose ID matches the flow variable {!OpportunityId}. Remember, that’s where you stored the ID of the opportunity that triggered the flow. Because IDs are unique, the flow only updates one opportunity. Then it sets the opportunity’s Discount Percentage field to the value of {!Discount}.

  1. After the paths merge, hover over Add Element and click Add Element.
  2. Click Update Records.
  3. For Label, enter Update Discount Field.
  4. For How to Find Records to Update and Set Their Values, select Specify conditions to identify records, and set fields individually.
  5. For Update Records of This Object Type, select Opportunity. The Update Records element’s search is limited to Opportunity records.
  6. For Condition Requirements, select All Conditions Are Met (AND).
  7. In Filter Opportunity Records, configure the filter criteria to find the opportunity that triggered the flow.

Field

Value

Field

Id

Operator

Equals

Value

{!OpportunityId}

  1. In Set Field Values for the Opportunity Records, configure the element to update the Discount Percentage field in the opportunity with the value stored in the flow variable {!Discount}.

Field

Value

Field

Discount_Percentage__c

Value

{!Discount}

  1. The New Update Records panel corresponding to the preceding steps.
  2. Save the flow.

Here’s what your finished flow should look like.

A view of the Flow Builder canvas with a finished flow

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities