Learning Salesforce Visual Workflow and Process Builder - Rakesh Gupta - E-Book

Learning Salesforce Visual Workflow and Process Builder E-Book

Rakesh Gupta

0,0
39,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Salesforce Management System is an information system used in CRM to automate the business processes like sales and marketing. To implement this, Force.com developed a powerful tool called Visual Workflow to automate business processes by creating applications also called Flows.

Learning Salesforce Visual Workflow, Second Edition is a practical guide on Flows that will enable you to develop custom applications in Salesforce with minimized code usage.

The book starts with an introduction to Visual Workflows that teaches all the building blocks of creating Flows and use it efficiently. You will learn how to easily automate business processes and tackle complex business scenarios using Flows. The book explains the working of the Process Builder so you can create reusable processes. The book also covers how you can integrate existing or newly created Flows with the Salesforce Lightening Experience.

By the end of the book, you will get a clear understanding on how to use Flows and Process Builder in your organization to optimize code usage.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 389

Veröffentlichungsjahr: 2017

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Title Page

Learning Salesforce Visual Workflow and Process Builder

Second Edition

Click your way to automating various business processes using Salesforce Visual Workflow and Process Builder
Rakesh Gupta

BIRMINGHAM - MUMBAI

Copyright

Credits

Author

Rakesh Gupta

Copy Editor

Stuti Srivastava

Reviewers

Chris Edwards

Jeff May

Project Coordinator

Vaidehi Sawant

Commissioning Editor

Aaron Lazar

Proofreader

Safis Editing

Acquisition Editor

Chaitanya Nair

Indexer

Francy Puthiry

Content Development Editor

Kinnari Sanghvi

Graphics

Abhinash Sahu

Technical Editor

Vivek Pala

Production Coordinator

Arvindkumar Gupta

Foreword

One of the undeniable trends of the 21st century has been "data is king". Our ability to collect and store data is reaching new heights every year. In 2000, companies knew who their customers were and how to contact them by phone, fax, or e-mail. In 2015, we have the technology to not only know who our customers are, but what each customer is doing with our products. Customers can submit feedback and help with requests with the click of a button, and there are "service needed" alerts built into products and equipment in nearly all industries. The "Internet of Things" allows a level of data collection that far exceeds our ability to review and respond.

Successful businesses know that the only thing worse than not knowing what your customers and products need is knowing but not doing anything about it. Data interpretation and response are just as important as collection and analysis. One of the most effective ways to ensure an appropriate and timely response is to let our business technology systems react to the data using the same business rules we would apply if we had the time to review the data ourselves.

This book, Learning Salesforce Visual Workflow and Process Builder, Second Edition, teaches Salesforce administrators how to use the business process automation features available in Salesforce to do just that—detect and react to data as it's being collected by your employees, your customers, and your products. These powerful tools can be confgured by admins (no development teams and custom coding needed), maintained by admins, and be quickly modified to meet the ongoing needs of your business.

Salesforce, a leading global business technology platform, knows that the key to their customers' success is the ability to understand and interact with data. With three releases each year, Salesforce consistently adds and enhances features that help maximize the value of each piece of data and customer contact. The Spring '15 release was no exception. Enhancements to Visual Flow and the introduction of the powerful new Process Builder put even complex business process automation into the hands of non-programming system administrators.

The author, Rakesh Gupta, is a long-time veteran of the IT industry and has been part of the evolution, from raw data collection to information analysis. His previous books explain how to collect and share data using the Salesforce platform and also how to report and analyze that data. With this book, Rakesh adds another key piece to the data–to-information cycle: data interpretation and response.

Using the techniques explained in this book, Salesforce administrators will be able to provide truly responsive business processes to their operational teams—putting data in the right format, in front of the right people, and at the right time—all without developing custom code.

Jeff May

Salesforce MVP and Partner @ Miss The Iceberg

About the Author

Rakesh Gupta is a graduate of SRM University, Chennai, with a degree in information technology. He previously worked at iGate Computer Systems Limited (now part of Capgemini). He is a three-time Salesforce MVP, evangelist, Salesforce trainer, blogger, and works as a Salesforce solution architect. He has been working on the Salesforce.com platform for over 6 years. He is from Katihar, Bihar, and lives in Alpharetta, USA. He is the co-author of Developing Applications with Salesforce Chatter and Salesforce.com Customization Handbook, both by Packt. He is the author of Learning Salesforce Visual Workflow and Mastering Salesforce CRM Administration, also by Packt. He is also a technical reviewer of Learning Force.com Application Development and Mastering Application Development with Force.com, Packt Publishing.

He's best known as an automation champion in the Salesforce ecosystem, as he has written over 110 articles on Visual Workflow and Process Builder to show how someone can use them to minimize code usage. He is one of the biggest Visual Workflow and Process Builder experts in the industry. He has trained more than 600 professionals around the globe and conducted corporate trainings. He currently holds nine certifications in Salesforce. He works on all the aspects of Salesforce and is an expert in data migration, process automation, configuration, customization, and integration. He is the leader of the Navi Mumbai and Nashik Salesforce developer user groups in India. He is also the initiator of the Mumbai Salesforce user group, and the initiator of the biweekly online webinar Automation Hour (automationhour.com). He is very passionate about Force.com and shares information through various channels, including the Salesforce Success Community and his blog at https://automationchampion.com/.

You can follow him on Twitter at @rakeshistom and @automationchamp.

First and foremost, I would like to thank my parents, Kedar Nath Gupta and Madhuri Gupta, and my sister, Sarika Gupta, for having patience with me for taking yet another challenge, which decreases the amount of time I can spend with them. They have been my inspiration and motivation for continuing to improve my knowledge and move my career forward. I would like to thank Packt Publishing for giving me this opportunity to share my knowledge via this book. I would also like to thank my friend Meenakshi Kalra for helping me while I was writing this book. A special thanks to all my well-wishers and friends. I would like to especially thank Jeff May (Salesforce MVP) and Chris Edwards (Salesforce MVP); without you, this book would never find its way to the Web. At the end, I’m grateful to every member of Salesforce Ohana--hope you will find this book useful!

About the Reviewer

Chris Edwards is a Salesforce MVP, user group leader, writer, and holder of 12 Salesforce certifications, including Application Architect. He has been working on the Salesforce platform for 7 years as an administrator, consultant, and architect, and is currently using cloud solutions to connect people to cures through his work as a Solution Architect in the healthcare industry with Mavens (www.mavens.com).

Uncountable thanks, as ever, to my (much) better half, Natalie, who makes me feel lucky to be alive--in the sense that she’s forever leaving sharp knives blade-up in the dishwasher but hasn’t succeeded in mortally wounding me quite yet.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://goo.gl/97OEal.

If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!

Table of Contents

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Getting Started with Visual Workflow

Business problems

Business use case 1

Solution 1 - using an Apex trigger

Solution 2 - a combination of Visual Workflow and Process Builder

Solution 3- using Process Builder

Business use case 2

Solution 1 - using Apex

Solution 2 - a combination of Visual Workflow and Process Builder

The benefits of Visual Workflow

System requirements for using Visual Workflow

An overview of the Visual Workflow lifecycle

An overview of the Cloud Flow Designer

An overview of the building blocks of Visual Workflow

Flow elements

Flow resources

Flow connectors

The various ways to invoke a Flow

Visual Workflow outcome behavior

Creating an Admin playground account

Logging in to Salesforce.com

Summary

Creating Flow through Point and Click

Creating the building blocks of Flow

Creating a variable

Creating a collection variable

Adding values to a collection variable

Creating an SObject Variable

Creating an SObject Collection Variable

Allowing users to pause Flows

Designing the Flow

Hands on 1 - displaying a logged-in user ID

Creating a Screen element

Adding fields to the Screen element

Removing fields from the Screen element

Setting the Start element in a Flow

Saving a Flow

Running a Flow

Hands on 2 - real estate commission calculator

Connecting the Flow elements

Hands on 3 - displaying a feedback form based on conditions

Adding a Decision element

Adding a choice to a Flow

Hands on 4 - displaying related records based on search functionality

Adding a Dynamic Record choice to a Flow

Hands on 5 - creating an opportunity form

Adding a Picklist choice to a Flow

A few points to remember

Exercises

Summary

Manipulating Records in Visual Workflow

Creating the building blocks of a Flow

Creating a constant

Creating a Text Template

Manipulating the data

Hands on 1 - creating leads

Adding the Record Create element to a Flow

Hands on 2 - adding leads to a campaign

Adding a record to a parent

Activating a version of a Flow

Passing values to Flow variables through a URL

Setting the finish location or redirecting the URL for a Flow

Hands on 3 - quickly update an account record

Adding Record Update elements to a Flow

Hands on 4 - cleaning Chatter group feed

Adding the Record Delete element to a Flow

Hands on 5 - adding Flow to the home page layout

Saving a Flow as a different version

Adding the Record Lookup element to a Flow

Hands on 6 - adding an image to Display Text

Hands on 7 - saving data from a feedback form

Hands on 8 - sending an e-mail

Hands on 9 - creating a custom error message

Hands on 10 - conditional execution of a Flow with JavaScript

A few points to remember

Exercises

Summary

Debugging and New Ways to Call a Flow

Debugging your Flow

On screen debugging

Inbuilt debugging tools

Using debug screens

Debug log

Setting the debug log filter

Who can run the Flow and how

Debugging insufficient privileges on the custom button/link

Embedding a Flow into a Visualforce page

Invoking a Flow using Process Builder

Automating your business process

Hands on 1 - copying the record followers

Adding the Fast Lookup element to a Flow

Adding the Loop element to a Flow

Adding an Assignment element to a Flow

Adding the Fast Create element to a Flow

Hands on 2 - open a Flow for unauthenticated access

Customizing the Flow user interface

Hands on 3 - setting finish behavior on the Visualforce page

Using the URLFOR function

Using the $Page variable

Using a controller

Hands on 4 - accessing a Flow through Salesforce1

Through the Salesforce1 navigation menu

Through publisher actions

Hands on 5 - setting Flow variables value from a Visualforce page

Without a controller

With the standard controller

With the custom controller

Calling a Flow using the custom controller

Hands on 6 - invoking a Flow using an Inline Visualforce page

Hands on 7 - using Flow to save the data from Visualforce page

Hands on 8 - using cross-object fields in Flow

Referencing a cross-object field in Flow

Cross-object field references in simple relationships

Cross-object field references in polymorphic relationships

A few points to remember

Exercises

Summary

Developing Applications with Process Builder

An overview of Process Builder

Business problems

Browser requirements for using Process Builder

An overview of the Process Builder user interface

Actions available in Process Builder

Differences between Process Builder and other tools

Creating applications with Process Builder

Hands on 1 - auto create a child record

Creating a Process

Adding an object and evaluation criteria

Adding process criteria

Adding an action to a Process

Activating a Process

Deactivating a Process

Deleting a Process version

Hands on 2 - auto update child records

Hands on 3 - cloning a Process

Adding an Apex plugin to your Process

Hands on 4 - posting opportunity details to the Chatter group

Hands on 5 - sending an e-mail to the opportunity owner

Hands on 6 - checking time-dependent actions from Process Builder

Hands on 7 - submitting a record to an Approval Process

Hands on 8 - calling a Flow from Process Builder

A few points to remember

Exercises

Summary

Building Efficient and Performance Optimized Processes

An overview of process management

Using Audit Trail to track setup changes in a Process or a Flow

Hands on 1 - using Workbench to get all the details of a process

Hands on 2 - using custom labels in Process Builder

Creating a custom label

Hands on 3 - using a Quick action to add a record to a Chatter group

Hands on 4 - calling an Apex class from Process Builder

Hands on 5 - bypass processes using Custom Permission

Creating a custom permission

Hands on 6 - defining additional conditions when updating records

Hands on 7 - scheduling multiple groups of actions

Hands on 8 - executing multiple criteria of a process

Reordering the criteria node in Process Builder

Hands on 9 - creating reusable processes using invocable process

Creating a master process to call a invocable process

A few points to remember

Exercises

Summary

Building Applications without Code

Distributing or deploying Flows and Processes

Deploying using Change Sets

Hands on 1 - creating an unmanaged package

Hands on 2 - displaying messages after login

Connecting a Login Flow to a profile

Hands on 3 - setting the Login Flow finish behavior

Hands on 4 - understanding Subflow and the Wait element

Creating a master Flow

Adding a Subflow element to a Flow

Hands on 5 - adding a Wait element to a Flow

Launching the Flow from Process Builder

Checking time-dependent actions from Flow

Hands on 6 - using custom metadata types in a Flow

Launching the Flow from Process Builder

Hands on 7 - creating scheduled jobs using a Flow

Hands on 8 - creating a recurring job using a time-dependent workflow and Process Builder

Hands on 9 - queuing a job for the next day

A few points to remember

Exercises

Summary

Enabling Flows to Work with Lightning Experience

Lightning runtime experience for Flows

Hands on 1 - enabling a Flow in Lightning skin

Hands on 2 - embedding a Flow into a Lightning App Page

Hands on 3- enabling Lightning App Pages to Salesforce1 and Lightning Experience users

Hands on 4 - embedding a Flow into a Lightning Record Page

Hands on 5 - displaying two columns Flows

Enabling custom record page for your Lightning Experience users

Hands on 6 - displaying a two-column Flow through a custom button

Hands on 7 - redirect Flows that render in Lightning Runtime

Adding a retURL to custom button

A few points to remember

Exercises

Summary

Learning Salesforce Visual Workflow and Process Builder

Second Edition

Copyright © 2017 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: April 2015

Second edition: May 2017

Production reference: 1120517

Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78728-499-9

www.packtpub.com

Preface

We wrote this book for Salesforce developers, administrators, customers, and partners to get started with Salesforce Flow and Process Builder. This book will act as both a reference for the administrator and a configuration guide for the newbie customer who want to develop an application in Salesforce without code, using Process Builder and Flow.

This book covers all the possible features of Salesforce Flow and Process Builder. We have taken the hands-on approach with real-time scenarios so that you can get a complete overview of these topics. At the end of every chapter, you will find key points and exercises for practice. Salesforce CRM is a service by Salesforce.com, which is commercial, but all the material in this book is developed using the developer edition.

What this book covers

Chapter 1, Getting Started with Visual Workflow, starts with basic knowledge of Salesforce Visual Workflow. We will then pick a few business examples and see how to use Flow instead of Apex code to solve them, and we’ll the discuss the benefits of using Salesforce Visual Workflow. You will also get an overview of the Flow canvas and its elements.

Chapter 2, Creating Flows through Point and Click, introduces you to the various variables available in Flow, and then proceeds toward the designing of Flow using the Screen, Wait, Assignment, and Decision elements.

Chapter 3, Manipulating Records in Visual Workflow, talks about constant and Text template in Flow and then takes you toward the manipulation of data using Record elements. We will see how to send an e-mail from Flow. We will also cover various ways to access the Flow.

Chapter 4, Debugging and New Ways to Call a Flow, serves as the climax of the book, where you will learn how to debug and launch a Flow. We will cover various ways to set the Flow variable using the Visualforce Pages and apex.

Chapter 5, Developing Applications with Process Builder, helps you get a complete understanding of the Process Builder designer and all the actions available inside it.

Chapter 6, Building Efficient and Performance Optimized Processes, helps you understand Process Builder and its concepts, such as how to use Custom Metadata Types, Custom Permissions, and Custom Labels with Process Builder. We will also cover some key concepts, such as using multiple groups of actions and how to call an Apex class from Process Builder.

Chapter 7, Building Applications without Code, starts by introducing you to the various ways to deepen the Flow. We will also cover key elements such as Login Flow using the Wait element in the Flow. We will also cover how you can use custom settings in the Flow and create a scheduled job that will run on a daily basis.

Chapter 8, Enabling Flows to Work with Lightning Experience, explains how you can use new or existing Flows to work with Salesforce Lightning Experience.

What you need for this book

Visual Workflow is available in Enterprise, Performance, Unlimited, and Developer Editions. The requirements are as follows:

Windows Internet Explorer versions 8 through 11 (6 and 7 are not supported), Google Chrome, or Mozilla Firefox

Adobe Flash Player Version 10.1 and later, the minimum version required to run the Cloud Flow Designer is 10.0

A minimum browser resolution of 1024 x 768

Who this book is for

This book is intended for those who want to use Flow to automate their business requirements by click, not code. Whether you are new to Salesforce or you are a seasoned expert, you will be able to master both Flow and Process Builder. Since Salesforce maintains an incredibly user-friendly interface, no previous experience in computer coding or programming is required. The things that you do require are your brain, your computer with a modern web browser, a free Salesforce developer org, and just basic knowledge of Salesforce.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The next lines of code read the link and assign it to theBeautifulSoupfunction."

A block of code is set as follows:

<style type="text/css">.FlowDate { color: Blue; font-family: Courier New;}</style>

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "The next task is to add a new custom button on the campaign page layout. Navigate toSetup|Build|Customize|Campaigns|Page Layouts, and click on theEditlink."

Warnings or important notes appear in a box like this.
Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

Log in or register to our website using your e-mail address and password.

Hover the mouse pointer on the

SUPPORT

tab at the top.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box.

Select the book for which you're looking to download the code files.

Choose from the drop-down menu where you purchased this book from.

Click on

Code Download

.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR / 7-Zip for Windows

Zipeg / iZip / UnRarX for Mac

7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learning-Salesforce-Visual-Workflow-and-Process-Builder. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

Getting Started with Visual Workflow

This chapter starts with an overview of Visual Workflow (also called Flow) and its benefits, which take the discussion forward to the various business requirements where we can use Flow. We will discuss various business problems and how we can develop an application without using code to solve them. By the end of this chapter, you will have learned various ways to invoke a Flow and the fundamentals of Visual Workflow.

In the next few chapters, you will be briefed about various concepts related to Visual Workflow and learn numerous ways to create point-and-click solutions without using code. We will also see different ways to streamline our sales process and automate our business process using a Flow. In the last few chapters, we will go through how to automatically launch a Flow using Process Builder, how to create reusable processes using Process Builder, and how to enable Visual Workflows to work with Lightning Experience.

We will cover the following topics in this chapter:

Business problems

The benefits of Visual Workflow

System requirements for using Visual Workflow

An overview of the Visual Workflow life cycle

An overview of the Cloud Flow Designer

An overview of Visual Workflow building blocks

The various ways to invoke a Flow

Visual Workflow

outcome behavior

Visual Workflow is a drag and drop interface that allows you to automate business processes by creating applications using clicks not code. Using Visual Workflow, we can create, update, edit, and delete records as well as send e-mail, submit records for approval, post to chatter, and take user input in Salesforce and then make those Flows available to the business users or systems. Visual Workflow can execute business processes, interact with the database, invoke Apex classes (an Apex class implements the Process.Plugin interface), and create a series of screens to take user input in order to collect and update data in Salesforce; Flows can also be built with no user interface to allow them to be run from automated processes.

Business problems

As a Salesforce administrator or developer, you may get business requirements from businesses to streamline the processes. Many of them are achievable using out-of-the-box (OOB) concepts, and for others, we have to use Apex or Visualforce pages. Visual Workflow gives us another method that will let us implement many business processes without needing custom coding. A few examples are discussed in the following sections.

Business use case 1

Sara Bareilles is working as a Vice President, Sales, in a company named Universal Containers. She wants to auto-close all the open opportunities with the Closed Lost stage, when an account out of business field (that is, custom field) is checked.

There are several ways to solve the business requirement; these are mentioned in the following sections.

Solution 1 - using an Apex trigger

Because this requirement means that many child records (opportunities) need to be updated when a parent record (Account) is edited, we can't achieve the preceding business requirement using the Workflow rule. The next possibility is to use an Apex trigger. Generally, a developer writes an Apex trigger on the Account object to update all the open opportunities when an account's custom field, out of business, gets updated to True. The following is the sample code:

trigger UpdateRelatedOpportunites on Account (after update) { for (Account AccountToUpdate : trigger.new) { If (AccountToUpdate.Out_Of_Business__c==True) { // Your logic; } } }

In addition, you'll need a test class and then use a change set, Force.com IDE or Force.com Migration Tool, to deploy the trigger and test classes to production. This also means that any change to the business logic will require more development work.

Solution 2 - a combination of Visual Workflow and Process Builder

Another way to achieve the same business requirement is to use a combination of Visual Workflow and Process Builder. Here is the description of the next screenshot:

Section highlighted as 1

: In this, a sample Flow updates all the open Opportunity stages to Closed-Lost related to an account that is marked as out of business.

Section highlighted as 2

: This is the

process on the

Account

object; it will always fire whenever an account record gets created or updated.

The following screenshot represents solutions for a similar business scenario by using Visual Workflow and Process Builder:

Process Builder is one of the ways to automate complex business requirements using click not code, similar to the Workflow rule and Visual Workflow. The benefit of using this approach is that you can easily follow the Salesforce best practice to create one process per object and use Visual Workflow to manage logic for multiple business requirements. We will discuss this in Chapter 5, Developing Applications with Process Builder,andChapter 7, Building Applications without Code.

Solution 3- using Process Builder

Another way to achieve the same business requirement is to use a process created on Process Builder. Here is the description of the next screenshot:

A process on the

Account

object, which will fire when the out of business checkbox is checked

Then the

Update Records

action will be fired, and it will update all the open Opportunity stages to the Closed-Lost stage related to an account which is marked as out of business

The following screenshot represents solutions for a similar business scenario using Process Builder:

Process Builder allows you to automate complex business processes using click not code.

Business use case 2

Robby Williams is working as a customer success manager in Universal Containers. He wants to send a reminder e-mail on a weekly basis to all the users who don't have a profile picture on Chatter.

Again, there are plenty of ways to solve this requirement. Some of the ways are as follows.

Solution 2 - a combination of Visual Workflow and Process Builder

An alternative way to accomplish the same business requirement is to use a combination of Visual Workflow and Process Builder. Here is the description of the next screenshot:

Section

highlighted as 1

:

This represents a Flow to send e-mail alerts to all users who do not have profile pictures on Chatter

Section

highlighted as 2

:

This represents the

Flows

action from Process Builder on a custom object (reminder notification) to trigger our Flow

The following screenshot represents the solution for business scenario 2 using Visual Workflow and Process Builder:

The benefits of Visual Workflow

There are certain benefits of using Visual Workflow. They are as follows:

It allows you to create an automated business process using clicks not code.

Visual Workflow does not require coding, and even if you do not know Apex code, you can still develop business processes.

Using screens, fields, and choices, you can implement complex business processes to make sure that your users are entering data in the right format.

Through Visual Workflow, you can manipulate data for certain objects that are not available for the Workflow rule or Process Builder. For example, when a "contact role" is created or updated as primary for an opportunity, then create a new task.

It allows you to auto submit records for approval.

It allows you to apply assignment rules on leads or cases that are created by API calls.

You can post messages on Chatter. For example, if the Opportunity status is changed to Closed-Won, post a message on the Chatter group.

It allows you to embed the Flow into the Visualforce page, and you can expose it for unauthenticated access using the

Force.com

site.

Once you embed your Flow into the Visualforce page, it allows you to use HTML, CSS, JavaScript, and other Visualforce components.

It can be easily maintained by non-developers.

Since it is not code, you don't need to write test classes.

You can make changes directly to your production organization, just like other configuration changes.

Every time unhandled processes fail or an error occurs in the Flow, the author will get an e-mail from Salesforce with the error details.

Using the debug log, you can debug your Flow. Visual Workflow also has a built-in debugging tool. To open the debug window, press

Ctrl

+

Shift

+

M

(on PC) or

command

+

shift

+

M

(on Mac).

It allows you to invoke the Apex class that implements the

Process.Plugin

interface.

System requirements for using Visual Workflow

Visual Workflow is available in Lightning Enterprise, Lightning Unlimited, and Developer Editions. You can access Flow on any platform. The requirements are as follows:

Windows Internet Explorer versions 8 through 11 (6 and 7 are not supported), Google Chrome, or Mozilla Firefox.

Adobe Flash Player Version 10.1 and later. The minimum version required to run the Cloud Flow Designer is 10.0.

A minimum browser resolution of 1024 x 768.

An overview of the Visual Workflow lifecycle

The Cloud Flow Designer is a tool to create Flows, configure screens, and define business logic for your Flows without writing a single line of code. Visual Workflow has three different parts, which are as follows:

Design

: This allows you to create the Flows using the Flow Designer, which has a drag and drop user interface that allows you to draw the Flow structure and configure how it runs, without writing a single line of code.

Administration

: Once you have created a Flow, you can manage it, edit its properties, activate, deactivate, delete, save as a new version or new Flow, or run it as well.

Runtime

: A Flow user can run the active Flow from a custom button, link, Visualforce page, or directly from the Flow URL. If it is

Autolaunch Flow

, then systems can run active Flows through Process Builder or an Apex class.

An overview of the Cloud Flow Designer

The Cloud Flow Designer is a tool that allows you to implement business requirements by constructing Flows (without any code); this is a way to collect, update, edit, and create data in Salesforce. The Cloud Flow Designer user interface has different functional parts as shown in the following screenshot:

These functional parts are as follows:

The button bar

: You can use

Save

,

Save As

,

Run

,

Run with Latest

,

Close

, undo, and redo changes to run or view properties of your Flow buttons available in the button bar. The status indicator marked in the red rectangle on the right-hand side of the bar shows the status (

Active

or

Inactive

) of your Flow:

Save

: Use this option to save/quick save your Flow.

Save As

: If you want to clone the Flow you are working on or save as a new version, then use this option.

Run

: This runs the most recent version of the Flow you are working in. If the Flow comprises subflow elements, then each subflow refers to the active version of its referenced Flow. If the referenced Flow has no active version, then the subflow element runs the latest version of its referenced Flow.

Run with Latest

: This button will only appear if you are working in a Flow that contains a subflow element.

Close

: If you are working on a Flow and want to close it, then use this button. If Flow is not saved and you clicked on the

Close

button, then it will return to the Flow list page or else you will be redirected to the Flow detail page.

Undo

or

Redo

: Use these to undo or redo recent activities on the canvas.

Flow Properties

: Click on the screw driver icon to see information related to your Flow, such as

Name

,

Unique Name

,

Description

, its type (

Autolaunched Flow

or

Flow

),

Interview Label

,

Version

, and created and modified dates. Salesforce allows you to change

Name

,

Description

, and

Interview Label

of your Flow at any time, as shown in the following screenshot:

The Interview label helps us differentiate between the interviews of the same Flow when an interview is paused.

The Flow canvas

: You can use this area to design your Flow. To edit any element in the main canvas, double-click on it.

The zoom control

:

This is a slider that helps you to zoom in and out of the canvas so that you can focus on particular areas. This feature is also combined with the search options on the

Explorer

tab, so it will highlight results on the canvas tab:

Palette

: This is the area where you can find all the element types available for your Flow. You have to drag and drop elements from the palette onto the canvas to use it. To see the element description/properties in the

Description

panel (

7

), click on an element in the palette. Once you have created new elements, they will appear in the

Explorer

tab. The

Palette

tab also has a search field to quickly find what you need.

Resources

: The

Resources

tab allows you to create new resources for your Flow, for example, variables, formulas, and templates. Once you have created new resources, they will appear in the

Explorer

tab. To create new resources, double-click on it.

Explorer

: The

Explorer

tab contains all the elements and resources added to the Flow. Double-click on the items from the list to edit them and click to view their details and usage in the

Description

panel (

7

).

Description

: The

Description

panel shows the item's description when you view an item in the

Palette

or

Resources

tab. It has two subtabs, as follows:

Properties: This shows the information, such as Unique Name, Description, Data Type, Input/Output Type, and Default Value for the element or resource you have selected:
Usage: This lists the elements where the selected item is used:

In Chapter 2, Creating Flow through Point and Click, we will start using the elements, variables, and concepts that you learned here.

An overview of the building blocks of Visual Workflow

Flow has three major building blocks known as Element, Connector, and Resource. With the help of these blocks, you can easily develop Flows.

The Element block represents an action that Flow can use to display or collect information from the Flow user, create or update records, delete records, or loop logic. TheElement blockis used to manipulate the data. The Connector block is used to establish the path between the elements. A Resource block is used to hold the data that you can reference in your Flow.

Flow elements

Flow elements represent actions that Flow can execute such as RecordUpdate, Record Lookup, Fast Lookup, Loop, Screen, and Decision. This is used to read, write, or delete data. Using the element (Screen), you can also display data and capture input from users. Use the Palette tab to drag and drop new elements onto your canvas. Once you add elements, it will be available on the canvas and Explorer tabs.

There are several types of elements available under the Palette tab. They are as follows:

Flow element

Description

Step

You can use this as a placeholder while designing your Flow. Later, you can convert

Step

elements into

Screen

elements.

Screen

This will display a screen to the user who is running the Flow. The

Screen

element contains input or output fields. The

Screen

element is mainly used to take input from users or display guided information.

Decision

This is used to evaluate conditions to determine which Flow path to take.

Assignment

This is used to set or change values of variables, collection variables, SObject variables, and SObject collection variables.

Loop

This iterates through an SObject collection variable and assigns an item's value to an SObject variable.

Wait

If you want your Flow to wait for one or more defined events to occur, then use this element.

Record Create

This is used to create one record using the field values that you specify separately. You can assign these values from Flow resources such as variables, SObject variable, and the screen fields.

Record Update

This is used to update records using the field values that you specify separately. You can assign these values from Flow resources such as variables, SObject Variable, and the screen fields.

Record Lookup

This is used to extract one record that meets the filter criteria you specify, and then assign the record's field values to separate, individual Flow variables or individual fields on SObject variables.

Record Delete

This is used to delete records from Salesforce that meet the filter criteria you specify in your Flow.

Fast Create

This is used to create records using the fields' value from an SObject collection variable or to create one record using the field's value from an SObject variable.

Fast Update

This is used to update records using the field's value from an SObject collection variable or to update one record using the field's value from an SObject variable.

Fast Lookup

This is used to extract records to assign their field values to an SObject collection variable or query one record to assign its field values to an SObject variable.

Fast Delete

This is used to delete records using the ID value from an SObject collection variable or to delete one record by using the ID value from an SObject variable.

Apex Plug-in

This is used to call an Apex class that implements the

Process.Plugin

interface. If you used the tag property in the

PluginDescribeResult

class, the Apex class appears under a customized section. Otherwise, it appears under the

APEX PLUG-INS

section.

Subflow

This is used to invoke another Flow in the organization.

Quick action

This calls an object-specific or global action, such as

NewTask

and

LogACall

.

E-mail Alerts

This is used to send an e-mail using a Workflow e-mail alert to specify e-mail template and recipients.

Post to Chatter

Using this element, you can post a message to the feed for a specific record, user, or Chatter group.

Send Email

This is used to send an e-mail using Flow with the specific subject, body, and recipients.

Submit for Approval

This is used to auto submit one record for approval.

From Chapter 2, Creating Flow through Point and Click, we will start using these elements.

Flow resources

Resources are used to hold the data that you can refer in your Flow. The Explorer