Skip to main content
Durée estimée
Thèmes
Demander à la communauté

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 does two things. 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 the Discount variable.

  1. After the paths merge, 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.
  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.
    • For Field, select Id.
    • For Operator, select Equals.
    • For Value, select OpportunityId.
  8. In Set Field Values for the Opportunity Records, configure the element to update the opportunity’s Discount Percentage field with the value stored in the Discount variable.
    • For Field, select Discount Percentage.
    • For Value, select Discount

The New Update Records panel corresponding to the preceding steps.

  1. Click Save.

Here’s what your finished flow should look like.

A view of the Flow Builder canvas with a finished flow.

Partagez vos commentaires sur Trailhead dans l'aide Salesforce.

Nous aimerions connaître votre expérience avec Trailhead. Vous pouvez désormais accéder au nouveau formulaire de commentaires à tout moment depuis le site d'aide Salesforce.

En savoir plus Continuer à partager vos commentaires