Record Trigger Flow Scenario – When Account is updated then update Opportunity

Record Trigger Flow Scenario

Scenario: When the “Type” field of an Account is updated, you want to update the Opportunity “Type” field for all related Opportunities. Additionally, you want to apply different logic to update the “Opportunity Type” field for each Opportunity based on specific conditions.

 

Specific Conditions for Updating “Opportunity Type” Field:

The specific conditions for updating the “Opportunity Type” field for each Opportunity are as follows:

    1. If the Opportunity’s “Stage” is “Prospecting” and the Account’s “Type” is “Customer Direct,” set “Opportunity Type” to “Existing Customer – Upgrade.”
    2. If the Opportunity’s “Stage” is “Qualification” and the Account’s “Customer-Channel” set “Opportunity Type” to ” Existing Customer – Replacement.”

Answer

1.Understand the Requirement:

Trigger Point: When Account field ‘Type’ is updated.

Output: Set Opportunity field ‘Type’ based on specific conditions

2. Visualize the Flow:

Sequence:

  1. Record Triggered Flow – It will be Record Trigger Flow on Account as triggering point is account.
  2. Trigger the Flow When – When Account is Updated
  3. Set Entry Conditions – Don’t give entry conditions so that flow can be reused for other conditions. We can add decision element for different conditions
  4. Action and Related Records – Based on Account we need to make changes to Opportunity field. Which means Based on A Object do Changes to B object. In these scenarios we use action and related records.

A screenshot of a computer Description automatically generated

 

3. Decision: Use Decision element to check Account Type field – Customer Direct and Customer Channel

A screenshot of a computer Description automatically generated

A screenshot of a computer Description automatically generated

Below will be the output once you click on Done.

A diagram of a customer service Description automatically generated

Update Records: If the Opportunity’s “Stage” is “Prospecting” and the Account’s “Type” is “Customer Direct,” set “Opportunity Type” to “Existing Customer – Upgrade.”

A screenshot of a computer Description automatically generated

We will select Update Record Element for Each Decision.

Update Records: If the Opportunity’s “Stage” is “Qualification” and the Account’s “Customer-Channel” set “Opportunity Type” to ” Existing Customer – Replacement.”

A screenshot of a computer Description automatically generated

Once You click done it will look like below

A diagram of a process Description automatically generated

Debug The Flow: Let’s put account type field as customer channel while debugging the flow.

Click on Debug Button on top right corner

A screenshot of a computer Description automatically generated

A close-up of a sign Description automatically generated

Click Run

How the Interview Started – It gives detail about user who ran the flow, Api version, Account Id, Flow Start Time

A screenshot of a computer Description automatically generated

There are no entry criteria, so it shows null

A close-up of a sign Description automatically generated

Decision: It went inside Decision Element – Account Type equals Customer- Channel and skipped Account Type equals Customer – Direct

A screenshot of a computer Description automatically generated

It finds all Opportunities where Stage Name Equals Qualification and Update Opportunity Type field equals Existing Customer – Replacement

A screenshot of a computer Description automatically generated

You can see the dark blue line showing the debug Track going to decision element customer channel and updating opportunities accordingly.

A screenshot of a computer Description automatically generated

Now let’s check on the record level.

Open an existing Account as flow is triggered when Account is updated and change type to Customer – Channel and click Save.

A screenshot of a computer Description automatically generated

Opportunity having stage as Qualification will change type to Existing Customer Replacement

A screenshot of a computer Description automatically generated

Now that our use case has passed successfully let’s write Flow Test. Select ‘View Test’ Button on top right corner.

A screenshot of a computer Description automatically generated

Click on Create

Setup Test Details: On this screen we mainly have to put label name. Updated is automatically selected in our use case.

A screenshot of a computer Description automatically generated

Set initial Triggering Records: It means when record is created field values at that time

A screenshot of a computer Description automatically generated

Set Updated Triggering Records: This means record values when the account record is updated. Here we are putting type as Customer – Channel

A screenshot of a computer Description automatically generated

Set Assertions: Here we are saying that Update Element was visited by the flow – which contains when stage name equals Qualification, update Opportunity type equals Existing Customer Replacement . I am setting it true Because once we update Account type to customer channel then that Update Element should be visited by the flow.

A screenshot of a computer Description automatically generated

Click on Done -> View Test -> then ‘Run Test and View Details’

A screenshot of a computer Description automatically generated

Test Run Details – Is Passed

A screenshot of a computer Description automatically generated

You can similarly create Test case when Account type is Customer – Direct.

 

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes