News & Resources — Blog Posts

Process Builder and Visual Workflow – Your Admin’s Favorite Combo!

Posted by David White, Consultant

Life as a Salesforce administrator can be frustrating at times. Many project requirements or requests that seem easy enough, such as automatically assigning a user to a group upon creation, require a developer to create a trigger. But what if your developer doesn’t have time? What if you don’t have a handy developer to even work with?

Meet Process Builder and Visual Workflow, two of Salesforce’s automation tools that significantly expand a Salesforce administrator’s capabilities. As a quick overview, Process Builder allows you to use multiple criteria to execute several workflow actions on a single record/related record, whereas Visual Workflow opens up a whole world of possibilities for complex record updates, creation, and other actions. When used together, these tools empower an administrator to automate tasks, save them time, and add value to their organization.

Scenario: Add Users to Public Group Upon Creation

Let’s say your organization uses public groups to handle record sharing, library access, and email recipients. It is imperative that each appropriate user has access to these items as soon as they’re created, so you’ve decided to automate this task. You would use a Process, followed by a Flow, to accomplish this.

First: Create Your Process

Go to Setup, type “workflow” or “Process” in the quick find box and select “Process Builder” when the results populate. Hit “New” once you’ve loaded Process Builder, then give it a name, description, and select the process to start when “A record changes”.

You’ll then see your handy, blank Process Builder Canvas:

Complete the following steps on the various Process Builder nodes:

Object: Select “User” as the object and tell the process to kick off when a record is created.

Criteria: Add your user criteria for the public group addition. For instance, you might use the user’s profile ID, part of the user’s email address, or the user’s title. In our process, we’ll have the criteria set to the user’s title field containing the string “Manager” (no quotation marks).

Save your process so far and exit back to Setup – we need to use Flow before we come back to this!

Using the quick find bar, search for “Flows”, then select Flows under “Workflow & Approvals”. Select “New” once the page has loaded, and you’ll be taken to the following blank canvas:

Let’s take the following steps to help our user get into their public group:

Record Lookup: In the left sidebar under “Palette”, navigate to “Data”, and drag a “Record Create” element into the canvas. Have the element look up to the user object, set the look up field to “Id”, the Operator as “equals”, and the value will be a new variable you create. For our purposes, we’ll call it “VarUserId” (no quotation marks). Make sure it is a text variable with the Input/Output Type set to “Input and Output”! Then click OK.

Back in your Record Lookup element, you’ll see {!VarUserId} as the value in your criteria. In the below section, “Assign the record’s fields…”, use the record’s standard “Id” field and assign it to the variable you created. This ensures that the Id value you found can be reused later in the Flow. Then click OK and you will see your Record Lookup element on the Flow canvas.

Record Create: Though it may not seem intuitive, adding a user to a public group actually creates a public group member record in Salesforce. With this in mind, we’ll need to take a “Record Create” Element from the sidebar and drag it to the canvas. Note: you’ll need the Salesforce ID of the public group you want your users to join!

Once the “Record Create” element is up, give it a name, then have it create a “GroupMember” record with the following values:

  • GroupID = Your Public Group’s ID
  • UserOrGroupId = {!VarUserID} (the variable we created earlier)

As you can see, we’re not doing anything particularly fancy here: We’re just having the Flow create a public group member to link your newly created user with your existing public group. Click OK once you’re ready, then your Record Lookup element to your Record Create element by clicking the diamond below and dragging your cursor to the Record Create element. Set the “Record Lookup” as your start element by hovering your cursor over it and clicking the green circle. Your flow should look like this:

Then you need to save the flow. Give it a name, select “Autolaunched Flow” as the type, and you are all set for this section. Close the Flow Designer and activate the flow on the next screen. All done, right? Nope – we need to get back to our process! Return to Process Builder, find your Process, and add an Immediate Action to it. For the Action Type, select “Flows”, give it a name, and select your Flow from the last dropdown. Under “Set Flow Variables” choose “+ Add Row”, then find your {!VarUserId} variable, set it as a Reference, and make the value the user’s ID, [User].Id.

Click save when ready, then create a user using your criteria (their job title contains “manager” in this case). You will see that user in your public group as soon as they’re made!

We’ve only scratched the surface when it comes to Process Builder & Visual Workflow, but a combination of the tools can significantly improve your day-to-day as a Salesforce administrator. Drop us a line if you’d like to learn more about improving your organization’s CRM


Posted in Blog Posts, News Announcements, What We’re Reading