Friday, September 22, 2017

Salesforce Developer Beginner - Process Automation

Salesforce Process Automation Suite

Salesforce provides multiple tools to automate your org’s repetitive business processes: Lightning Process Builder, Visual Workflow, Workflow, and Approvals. The automation tool that you need depends on the type of business process that you’re automating.
  • What to do when a record has certain values
Example: Notify the account owner when a related case is escalated.
  • Collecting information from users or customers and then doing something with that information
Example: Customer support uses a wizard to step through a call script, and cases are created based on the information that they enter.
  • How a record gets approved
Example: Managers approve their direct reports’ requests for vacation.

What to Do When a Record Has Certain Values

Three of our tools can address this use case: Workflow, Process Builder, and Visual Workflow. Respectively, these tools create workflow rules, processes, and flows.
We recommend starting with Process Builder, especially for business processes that can be simplified to if/then statements. For example: if a case is escalated, then notify the account owner.
Process Builder includes almost all the functionality that’s available in workflow rules, and more. In fact, a single process can do what it would normally take multiple workflow rules to do. The only thing you can do with workflow that you can’t do with processes is send outbound messages without code. However, you can work around this limitation by calling Apex code from a process.
If the process is too complicated for the Process Builder or requires more advanced functionality, create a flow by using the Cloud Flow Designer. For example, create a flow to:
  • Use complex branching logic (if certain conditions are true, evaluate for further conditions)
Example: First, check whether a case is escalated. If the case is escalated, check the account’s region and route the case accordingly.
  • Sort through, iterate over, and operate on several records
Example: After an opportunity is closed and won, calculate the opportunity’s discount. Then apply that discount to all the related opportunity products.

Get Information from Users or Customers and Do Something with It

If you need to build a wizard to collect information, Visual Workflow is the tool for you. Create a flow that displays information to and requests information from a user. Then take the information that they enter and perform actions in Salesforce with it.
For example, create a flow that walks customer support representatives through a call script. The flow uses information that the representative entered, such as the caller’s name and account number, to create a case that’s assigned to the right person.
You can add more complexity to the flow to match your business process. For example:
  • Route the representative to different screens, depending on earlier choices. This prevents the representative from doing things like trying to upsell a product to a customer who already bought that product.
  • Check whether the reported problem is blocking the customer’s business and the account is high-value. If so, the flow notifies the region director.

How a Record Gets Approved

For example, when an employee requests time off, that time has to be approved by the employee’s manager. You need to ensure that when a time-off request is submitted for approval, the right person (the employee’s manager) receives the request.
To automate your organization’s processes for approving records, create approval processes.

Automation Tool Features

Here’s a breakdown of all the features and actions that are supported in each automation tool. Use it to determine which tool is best for your business needs.
Process Builder
Visual Workflow
Workflow
Approvals
Complexity
Multiple if/then statements
Complex
A single if/then statement
A single if/then statement
Visual designer
Yes
Yes
Browser support
All (Chrome recommended)
All (Safari not recommended)
All
All
Starts when
·         Record is changed
·         Invoked by another process
·         User clicks button or link
·         User accesses custom tab
·         Process starts
·         Apex is called
Record is changed
·         User clicks button or link
·         Process or flow starts that includes a Submit for Approval action
·         Apex is called
Supports time-based actions
Yes
Yes
Yes
Supports user interaction
Yes
Supported Actions
Call Apex code
Yes
Yes
Create records
Yes
Yes
Tasks only
Tasks only
Invoke processes
Yes
Delete records
Yes
Launch a flow
Yes
Yes
Yes(Pilot)1
Post to Chatter
Yes
Yes
Send email
(Email alerts only)
Yes
Yes(Email alerts only)
Yes(Email alerts only)
Send outbound messages without code
Yes
Yes
Submit for approval
Yes
Yes
Update fields
Any related record
Any record
The record or its parent
The record or its parent
1The Process Builder has superseded flow trigger workflow actions, previously available in a pilot program. Orgs that are using flow trigger workflow actions can continue to create and edit them, but they aren’t available for new orgs.

Process Builder

The Process Builder tool allows you to easily automate business processes using a convenient graphical representation of your process as you build it. Automated processes in the Process Builder consist of:
  • Criteria that determine when to execute action groups
  • Immediate and scheduled actions to execute when those criteria are met
Any change that causes a record to match the criteria automatically triggers the action group. From Setup, enter Builder in the Quick Find box, then click Process Builder. First up, click New, name your process, and click Next. Now you get to a page that looks something like this.




Button Bar (1)
Use the button bar to:
  • Expand or collapse actions on the canvas
  • Open the process management page
  • Create an inactive copy of the current process
  • Edit or view the properties of the current process
  • Activate or deactivate the current process
Canvas (2)

The canvas is the main workspace for a process. On the canvas, you can define:
  • The records that the process should evaluate (3)
    You identify the object and specify the changes to that object’s records that cause the process to run.
  • One or more criteria nodes (4)
    Each criteria node includes conditions that are used to evaluate the record. A criteria node evaluates based on filter criteria—such as whether the value for the Amount field is greater than $1000—or based on a formula. You can also simply execute the associated actions without evaluating the record.
  • One or more actions (5)
    If the criteria are met for the record that starts the process, the criteria node’s associated action group (6)either executes immediately or according to the schedule defined for the action.

Create Automated Processes

Create a simple process that creates a contract record and a follow-up task when a high-value opportunity is closed and won.
Tip: Draw out your business process before you try to automate it. Doing so makes it easier to configure when using one of our tools for process automation.
  1. From Setup, enter Process Builder in the Quick Find box, click Process Builder, and then click New.
  2. Name the process Opportunity Management. The API name updates to Opportunity_Management when you tab out of the Name field.
  3. For the description, enter If a high-value opportunity is closed and won, create a draft contract and a follow-up task for the account owner.
  4. Configure the process to start when a record changes.
  5. Click Save.
  6. Click Add Object to associate your process with an object and specify when to start the process. For this process, let’s choose Opportunity and start the process when the record is created or edited.
  7. Click Save.
Now let’s create a high priority follow-up task for the associated account’s owner. We’ll use a schedule so the owner can follow up with the account six days after the opportunity closes.
First, set up a schedule. A schedule lets the process know that it must wait to execute the associated actions. Because you can configure multiple schedules for the same criteria node, each schedule has its own list of actions to execute.
To add scheduled actions to your process, you have two options:
  • Start the process only when a record is created (1). Select this option when you choose an object for your process.
  • Start the process when a record is created or edited (2). In addition, select the advanced option to execute actions only when specified changes are made (3) when you add criteria to your process.
  1. Under Scheduled Actions, click Set Schedule.
  2. Set the schedule for six days after the opportunity closes.
  3. Click Save.
Now that you have a schedule, add the task creation action to it.
  1. Under Scheduled Actions, click Add Action.
  2. For the action type, select Create a Record.
  3. Name the action “Follow-up Task”.
  4. For the record type, select Task.
  5. Configure the task.
  6. Click Save.
Field
Type
Value
Assigned to ID
Reference
Opportunity > Account ID > Owner ID
Priority
Picklist
High
Status
Picklist
Not Started
Nice work! You’ve created a process that automatically manages your high-value business opportunities.
To start using this process, just activate it.
You can expand this process to include more criteria and actions. If the first criteria node that you defined doesn’t evaluate to true, the process could then check whether a high-value opportunity is closed and lost, or whether a quote was given, with more actions based on those conditions. The possibilities are endless!
With the Process Builder, it’s easy to manage an entire process in one place. To automate the same business process with workflow, you would have to create multiple workflow rules and use Apex triggers to create records.
Consider the following when creating automated processes.
  • You can reorder criteria nodes—just drag and drop them. However, you can’t change the order of actions. After you add actions, the only way to reorder them is to delete them and start over.
  • If you create processes to replace any workflow rules, make sure you delete or deactivate those workflow rules when you activate the equivalent processes. Otherwise, both workflow rules and processes fire and cause unexpected results, such as overwritten records or redundant email messages.
  • You can add scheduled actions only if the process starts when a record is created, or if the process starts when a record is created or edited and you select Yes when asked “Do you want to execute the actions only when specified changes are made to the record?”
  • A process can have up to 50 versions, but only one version of a process can be active.

No comments:

Post a Comment

Lightning Inter-Component Communication Patterns

Lightning Inter-Component Communication Patterns If you’re comfortable with how a Lightning Component works and want to build producti...