Table Of ContentSalesforce.com
Lightning Process
Builder and Visual
Workflow
A Practical Guide to Model-Driven
Development on the Force.com Platform
—
Jonathan Keel
Salesforce.com Lightning
Process Builder and
Visual Workflow
A Practical Guide to Model-Driven
Development on the Force.com Platform
Jonathan Keel
Salesforce.com Lightning Process Builder and Visual Workflow: A Practical Guide to Model-Driven
Development on the Force.com Platform
Jonathan Keel
San Antonio, Texas, USA
ISBN-13 (pbk): 978-1-4842-1690-3 ISBN-13 (electronic): 978-1-4842-1691-0
DOI 10.1007/978-1-4842-1691-0
Library of Congress Control Number: 2016960575
Copyright © 2016 by Jonathan Keel
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage
and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or
hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director: Welmoed Spahr
Acquisitions Editor: Susan McDermott
Developmental Editor: Laura Berendson
Technical Reviewers: Philip Weinmeister, James Loghry
Editorial Board: Steve Anglin, Pramila Balen, Laura Berendson, Aaron Black, Louise Corrigan,
Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Nikhil Karkal, James Markham,
Susan McDermott, Matthew Moodie, Natalie Pao, Gwenan Spearing
Coordinating Editor: Rita Fernando
Copy Editor: Lori Jacobs
Compositor: SPi Global
Indexer: SPi Global
Cover Image: Designed by Freepik.com
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com , or visit w ww.springer.com . Apress Media, LLC is a California LLC and the
sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com , or visit w ww.apress.com .
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at w ww.apress.com/bulk-sales .
Any source code or other supplementary materials referenced by the author in this text is available to
readers at w ww.apress.com . For detailed information about how to locate your book’s source code, go to
w ww.apress.com/source-code/ .
Printed on acid-free paper
To my children, Ashton, Janae, Logan, and Abigail, who bring
me great joy in life and are so thoughtful, supportive, and patient.
Contents at a Glance
About the Author ...................................................................................................xiii
About the Technical Reviewers ...............................................................................xv
Acknowledgments .................................................................................................xvii
Introduction ............................................................................................................xix
■ Chapter 1: A History of Workfl ow and Graphical Development .............................1
■ Chapter 2: Visual Workfl ow Basics .....................................................................17
■ Chapter 3: First Flow ...........................................................................................71
■ Chapter 4: Creating a Wizard ...............................................................................89
■ Chapter 5: Salesforce Data and Loops ...............................................................131
■ Chapter 6: Call Center Application ....................................................................167
■ Chapter 7: Lightning Process Builder Basics ....................................................199
■ Chapter 8: Cross-Object Updates with Lightning Process Builder ....................215
■ Chapter 9: Approval Process with Lightning Process Builder ...........................245
■ Chapter 10: Calling Autolaunched Flows ...........................................................273
■ Chapter 11: Notifi cations with Lightning Process Builder .................................289
■ Chapter 12: Extend Visual Workfl ow and Lightning Process Builder
with Apex ..........................................................................................................309
■ Chapter 13: Production Deployment—Giving the People What They Want! ......335
Index .....................................................................................................................353
v
Contents
About the Author ...................................................................................................xiii
About the Technical Reviewers ...............................................................................xv
Acknowledgments .................................................................................................xvii
Introduction ............................................................................................................xix
■ Chapter 1: A History of Workfl ow and Graphical Development .............................1
Getting Some Logic with Workfl ow ..................................................................................2
From Code to Workfl ow Rule ..................................................................................................................3
Documenting Processes .........................................................................................................................7
Graphical Development ....................................................................................................9
The Birth of Datafl ow Programming .......................................................................................................9
Enter Visual Workfl ow .....................................................................................................10
Next Up . . . Lightning Process Builder ...........................................................................14
Recap .............................................................................................................................16
■ Chapter 2: Visual Workfl ow Basics .....................................................................17
High-Level Concepts of Visual Workfl ow ........................................................................17
What Is a Flow? ....................................................................................................................................18
When to Use Visual Workfl ow vs. Workfl ow ..........................................................................................19
Visual Workfl ow Strengths and Limitations ..........................................................................................21
Intro to Cloud Flow Designer ..........................................................................................23
Anatomy of Cloud Flow Designer ..........................................................................................................24
Flow Elements ......................................................................................................................................30
Flow Resources ....................................................................................................................................55
Recap .............................................................................................................................69
vii
■ CONTENTS
■ Chapter 3: First Flow ...........................................................................................71
Create That Flow! ...........................................................................................................71
Requirements .......................................................................................................................................72
Dragging and Dropping .........................................................................................................................73
Screen Element Confi guration ..............................................................................................................77
Adding an Input Field ............................................................................................................................81
Recap .............................................................................................................................87
■ Chapter 4: Creating a Wizard ...............................................................................89
From Business Objective to Design ...............................................................................89
So What Are the Requirements? ...........................................................................................................90
From Requirements to Design ..............................................................................................................92
Building the Wizard ........................................................................................................94
Account Type Screen ............................................................................................................................96
Address Screen ....................................................................................................................................99
Phone Numbers Screen ......................................................................................................................102
SSN/Tax ID Screen ..............................................................................................................................104
Money Market or Savings Account? ...................................................................................................106
Money Market Account Terms Screen ................................................................................................108
Money Market Review Screen ............................................................................................................112
Checking Account Number Screen .....................................................................................................115
Is Interest High? Decision ...................................................................................................................117
Assignments .......................................................................................................................................119
Personal Savings Review Screen .......................................................................................................122
Save It, Run It! ....................................................................................................................................126
Recap ...........................................................................................................................129
■ Chapter 5: Salesforce Data and Loops ...............................................................131
Collections and Loops ..................................................................................................131
Riding on the Loop .......................................................................................................132
Looping Story and Requirements .......................................................................................................133
Designing the Loop .............................................................................................................................134
viii
■ CONTENTS
Implementing the Loop ................................................................................................136
Data Lookups ...............................................................................................................137
Record Lookup ....................................................................................................................................137
Fast Lookup ........................................................................................................................................140
Adding the Fast Lookup to the Flow ...................................................................................................142
Account Loop ................................................................................................................145
Defi ning the Body ...............................................................................................................................148
Assignment ..................................................................................................................153
Updating Records .........................................................................................................158
Fast Update ........................................................................................................................................159
Record Update ....................................................................................................................................159
Run the Flow ................................................................................................................163
Recap ...........................................................................................................................166
■ Chapter 6: Call Center Application ....................................................................167
What Is a Call Center App? ...........................................................................................167
Designing the App ........................................................................................................169
Onto the Flow Design .........................................................................................................................170
Implementation ............................................................................................................172
Call Center Transfer Subfl ow ..............................................................................................................176
Call Center Flow .................................................................................................................................186
The Main Flow ....................................................................................................................................192
Done, Done, and Wait There’s More ..............................................................................196
Adding a fl ow to a Visualforce Page ...................................................................................................197
Recap ...........................................................................................................................198
■ Chapter 7: Lightning Process Builder Basics ....................................................199
What Exactly Is a Process? ..........................................................................................199
The Anatomy of a Process ..................................................................................................................200
Lightning Process Builder User Interface ..........................................................................................204
ix
■ CONTENTS
When to Use Lightning Process Builder vs. Salesforce Workfl ow ................................207
Conditional Statements (If-Then Logic) ..............................................................................................208
Graphical Development ......................................................................................................................208
Time-Based actions ............................................................................................................................208
Call Apex Code ....................................................................................................................................209
Create Records ...................................................................................................................................209
Delete Records ...................................................................................................................................210
Update Records ..................................................................................................................................210
Launch Flows......................................................................................................................................210
Post to Chatter ....................................................................................................................................210
Send E-mail Alerts ..............................................................................................................................211
Send Outbound Messages (Without Code) .........................................................................................211
Submit for Approval ............................................................................................................................211
Strengths and Weaknesses of Lightning Process Builder ............................................211
Strengths of Lightning Process Builder ..............................................................................................211
Weaknesses of Lightning Process Builder ..........................................................................................212
Recap ...........................................................................................................................213
■ Chapter 8: Cross-Object Updates with Lightning Process Builder ....................215
The Business Case .......................................................................................................215
Set Account At Risk from Case Process .......................................................................217
First Criterion–Is SLA in Violation? ...............................................................................220
Second Criterion–Is Account At Risk? ..........................................................................234
Recap ...........................................................................................................................244
■ Chapter 9: Approval Process with Lightning Process Builder ...........................245
Approval Processes ......................................................................................................245
Manually Submitted Approvals ...........................................................................................................246
Automatically Submitted Approvals ....................................................................................................247
Approval Process Using Lightning Process Builder ......................................................248
The Parts Used for Approvals .............................................................................................................249
The Business Case .............................................................................................................................253
x
■ CONTENTS
The Design ..........................................................................................................................................254
First Set up the Approval Process .......................................................................................................256
Finishing with Lightning Process Builder ...........................................................................................263
Recap ...........................................................................................................................272
■ Chapter 10: Calling Autolaunched Flows ...........................................................273
Introducing Even More Flow Types ...............................................................................273
Standard Flow Types ..........................................................................................................................274
Other Flow Types ................................................................................................................................274
Autolaunched Flow from Lightning Process Builder ....................................................275
The Flows Action Type ........................................................................................................................276
Figuring Out Requirements and Design ..............................................................................................278
Building the Flow ................................................................................................................................279
Calling the Flow ..................................................................................................................................282
Recap ...........................................................................................................................288
■ Chapter 11: Notifi cations with Lightning Process Builder .................................289
Types of Notifi cations ...................................................................................................289
E-mail Alerts .......................................................................................................................................290
Chatter Posts ......................................................................................................................................290
Notifi cation Deep Dive ..................................................................................................291
E-mail Alerts Confi guration Details .....................................................................................................291
Post to Chatter Confi guration Details .................................................................................................293
Add Notifi cations to an Existing Process ......................................................................297
Adding the Post to Chatter ..................................................................................................................299
Adding an E-mail Alert ........................................................................................................................301
Recap ...........................................................................................................................307
■ Chapter 12: Extend Visual Workfl ow and Lightning Process Builder
with Apex ..........................................................................................................309
What Is Apex? ...............................................................................................................309
Calling Apex from a Flow ..............................................................................................312
Example: Generate Random Number ...........................................................................314
xi
Description:Learn how to build logic into your apps by configuring Salesforce.com Lightning Process Builder and Visual Workflow software tools to meet the needs of your organization without the use of code. You will be able to build workflow diagrams on the Salesforce.com platform and perform complex logic. Ind