Sample Flow to Generate CS Work Suggestion via an Account Triggered Flow

This page describes a sample flow to generate the CS work suggestion via an Account-triggered flow.

Warning:

This page does not give step-by-step instructions on how to create the sample flow. The information is intended for administrators who are already experienced at creating Salesforce flows. Refer to the Salesforce Help if you need information about how to create flows.

The Sample Flow

This sample flow is a Record-Triggered After Save Flow that uses the Process Policies Apex action.

Sample flow to generate work suggestion from account triggered flow

An explanation of each numbered item is provided in the table below.

Flow Element Explaination
# Flow Element Sample Flow Suggestion Sample Flow Setup
1 Flow element start

Create a new Record-Triggered flow. In the Configure Start window, set:

Object: Account

Trigger the Flow When: A record is updated

Condition requirements: Formula Evaluates to True;

Then add the following conditions:

{!$Record.Health_Score__c} <= 80

When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements

Optimize the Flow for: Actions and Related Records

Configure Start
2 Flow Element Apex Action

Add an Action element. Select the Process Policies action, then enter the required input values

Label: Process Policies

API Name: Process_Policies

Set Input Values

Account: {!$Record}

Event Description: {!EventDescription}

Transaction Control: Let the flow decide

Note:

For Event Description text template add Body as Account's Health Score has changed to {!$Record.Health_Score__c}.

Edit Process Policies
3 Flow Element Decision

Add a Decision element to validate the results of Process Policies.

Create a Success outcome and set the condition to: {!Process_Policies.IsSuccess} Equals {!$GlobalConstant.True}

Create an Error outcome and set the condition to: {!Process_Policies.IsSuccess} Equals {!$GlobalConstant.False}

For both outcomes, set When to Execute Outcome: If the condition requirements are met.

Edit Decision
4 Flow Element Assignment

For the faulty Process Policies apex action, add an Assignment element and set the following assignments:

{!ProcessPoliciesResultNotificationBody} Equals {!ProcessPoliciesFaultMessage}

{!ProcessPoliciesResultNotificationTitle} Equals Process Policies Failed

Note:

The Process Policies Fault Message is a text template.

Edit Assignment
5 Flow Element Get Records

For a successful outcome of the Process Policies decision element, add a Get Records element and complete the window as follows:

Object: Work Suggestion

Condition Requirements: All Conditions Are Met (AND)

Add the following condition: Id Equals {!Process_Policies.NewWorkSuggestionId}

How Many Records to Store: Only the first record

How to Store Record Data: Choose fields and let Salesforce do the rest

Select Work Suggestion Fields to Store in Variable: Id and Name

Edit Get Records
6 Flow Element Assignment

For the error in the Process Policies Decision element, add an Assignment element and set the following assignments:

{!ProcessPoliciesResultNotificationBody} Equals {!ProcessPoliciesErrorMessage}

{!ProcessPoliciesResultNotificationTitle} Equals Process Policies Failed

Note:

The Process Policies Error Message is a text template.

Edit Assignment
7 Flow Element Assignment

For the successful Get Records element, add an Assignment element and set the following assignments:

{!ProcessPoliciesResultNotificationBody} Equals {!ProcessPoliciesSuccessMessage}

{!ProcessPoliciesResultNotificationTitle} Equals Process Policies Succeed

Note:

The Process Policies Success Message is a text template.

Edit Assignment
8 Flow Element Action

Add an Action element to send email notification to the user.

Set Input Values

Recipient Addresses: [email protected]

Sender Type: CurrentUser; Sender Email Address: {!$User.Email}

For email content set the following:

Subject: {!ProcessPoliciesResultNotificationTitle}

Body: {!ProcessPoliciesResultNotificationBody}

Edit Send Email
9 Flow Element End End of flow.  
  Activate the flow Remember to save and activate the flow to make it available for use.