Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
Estimación de tiempo
Temas
Preguntar a la comunidad

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.

Comparta sus comentarios sobre Trailhead en la Ayuda de Salesforce.

Nos encantaría conocer su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios cuando quiera desde el sitio de la Ayuda de Salesforce.

Más información Continuar para compartir comentarios