Sonoma Partners Microsoft CRM and Salesforce Blog

Admin Toolkit: Advanced Process Automation with Visual Workflows

Today's blog post was written by Caitlin Pfeiffer, Principal Consultant at Sonoma Partners.

This blog post is written for the advanced admins out there. Ever asked to automate a process that is too complex to achieve with workflow rules or Process Builder, but you don't know Apex and you don't have a developer to help create an Apex Trigger. Try Visual Workflow!

Visual Workflow is an admin tool that is most commonly used for call scripting, but can also be used to complete more complex process automations with clicks, not code.

If you are starting to experiment with Visual Workflow, here are a few things to keep in mind:

  • Salesforce has published a Visual Workflow Guide that is a great reference and includes a few other examples.
  • If your use case requires you to automatically create Orders from Opportunities - great news! Salesforce provides some Flow templates to get you started. Check them out here.
  • Flows are subject to Salesforce governor limits, so if you expect this flow to run in bulk transactions (e.g. integrations or Data Loader updates), you may run into errors (Apex Triggers will need to be used in these cases).

To show you how you can use Visual Workflows to achieve some more complex process automations, I'll show you an example for a common use case I've heard from clients.

Use Case: Automatically creating renewal opportunities when an Opportunity is marked as Closed Won. The renewal Opportunity should be an exact clone of the original Opportunity including products, except the Close Date should be pushed 1 year out and the Stage should be reset to "Qualification." Below is a guide on how to set up this process automation.

1. Create Visual Workflow to create a renewal Opportunity. When you save this Flow,
make sure that you indicate that it is an Autolaunched Flow, so that you can trigger it from a Process Builder Flow (details in step #2). After saving the Flow, also make sure to activate the most recent version.

Pfeiffer 1

a. Create a Fast Lookup (see details below) to pull back the Opportunity details for the closed Opportunity. NOTE: This element should be set as the Start Element for the Flow.

Pfeiffer 2

i. Create a new Variable to store the Opportunity Id of the Closed Won Opportunity. NOTE: This variable will be passed into this Flow, so it will need to be set as an Input variable.

Pfeiffer 3

ii. Create a new sObject to store the Opportunity details.

Pfeiffer 4

b. Create a Fast Lookup (see details below) to pull back the Opportunity Line Item details for the given Opportunity.

Pfeiffer 5

i. Create a new sObject Collection Variable to store all of Opportunity Line Items from the closed Opportunity.

Pfeiffer 6

c. Create a new Assignment element to update the sOpportunity sObject with any of the values you'd like to update on the Renewal Opportunity (see example below) Opportunity with Renewal Values.

Pfeiffer 7

i. Create a new Formula to update the Opportunity Name to append "RENEWAL" to the end of it.

Pfeiffer 8

ii. Create a new Formula to update the Close Date to push it out 1 year.

Pfeiffer 9

d. Create a Fast Create to create the Opportunity using the values in the sOpportunity variable.

Pfeiffer 10

e. Loop through each line item in the cOpportunityLineItems collection variable.

Pfeiffer 11

i. Create a new sObject variable to store the current Opportunity Line Item in the collection variable.

Pfeiffer 12

f. Create a new Assignment element to update the sOpportunityLineItem sObject with the Opportunity Id of the Renewal Opportunity. NOTE: The Id of sOpportunity will be set with the Id of the newly created Opportunity in Step d.

Pfeiffer 13

g. Create an new Assignment element to add the sOpportunityLineItem to a new sObject Collection Variable. You will use this new collection variable to create the renewal Opportunity Line Items.

Pfeiffer 14

i. Create a new sObject Collection Variable to store the updated sOpportunityLineItem's.

Pfeiffer 15

h. Create a Fast Create element to create the Opportunity Line Items using the values in the cRenewalOpportunityLineItems collection variable.

Pfeiffer 16

2. Create a Process Builder Flow to automatically launch the Visual Workflow you just created. When you configure the Flow action, make sure that you are mapping the Opportunity Id to the vOpportunity variable in the Flow.

Pfeiffer 17

3. Voila! You're done! Make sure the Process Builder is activated and test that it's working as you expect. This is just a simple example, but you can use these principles for automating your business processes. Happy customizing!

Is your CRM

Topics: Salesforce