Difference between revisions of "Workflows"

From LongJump Support Wiki
imported>Aeric
imported>Aeric
 
Line 31: Line 31:
:* The path a [[Record]] takes through the workflow depends on the actions taken by the decision-makers (owners) in each state.
:* The path a [[Record]] takes through the workflow depends on the actions taken by the decision-makers (owners) in each state.
:* A ''workflow owner'' is someone who can take action to transition a record to a new state.
:* A ''workflow owner'' is someone who can take action to transition a record to a new state.
:* Depending on the choices made for a Workflow state, either the ''record owner'' or the ''task owner'' (or both) can edit a record in that state. ''No one else is allowed to edit that record'', even if their role and team permissions would otherwise allow them to do so.
:* Depending on the choices you make when you [#Edit an Intermediate State|Edit an Intermediate State]], either the ''record owner'' or the ''task owner'' (or both) can edit a record in that state. ''No one else is allowed to edit that record'', even if their role and team permissions would otherwise allow them to do so.


===Workflow States===
===Workflow States===

Latest revision as of 02:51, 11 January 2014

Designer > Objects > {object} > Workflows

A workflow models business processes, and offers the ability to automate tasks and actions based on business rules.

1 About Workflows

Business processes are part of everyone's typical work day. When ordering office supplies, writing a proposal or preparing an invoice, staffers in your organization follow a series of steps to complete a task, getting approvals and feedback from supervisors/managers along the way. Workflows model those processes.

See an overview of the workflow designer in this Video Tutorial

The Workflow Designer lets you build custom workflows graphically. Then, when users examine individual data records, they are automatically provided with action buttons that take the record to the appropriate next step.

1.1 A Simple Example

As users take Action on records, the workflow State changes

For example, the following process describes the steps to approve reimbursement for a business expense:

  1. To request reimbursement for a business expense, an expense record is created.
    Since it has not yet been Submitted, the request record is in the Start state.
  2. To submit the request, the user clicks the [Send for Approval] button.
    That action transfers the record to the Mgr Review state.
  3. The Manager reviews the request record and clicks [Approve].
    The request record is now in the Finance Review state.
  4. When Financial reviewers approve the request, they click [Issue Check], and the reimbursement check is issued.
  5. The request record then exits the workflow, leaving it in the End state.

1.2 Records, States, Actions, and Owners

A workflow is defined by record states that define a record's status, the actions that transition between those states, and workflow owners--the people who choose those actions.

The key points to remember are:

  • Workflows define paths that a record can travel.
  • A State is a destination for an action.
  • An Action transitions a record to a new state.
  • Each State has one or more designated Owners--teams, roles, or specific individuals who are authorized to decide which next step is appropriate, and can take that action. In the Finance Review state above, for example, members of the Finance Review team are authorized to approve issuing a check.
  • Every Action becomes a button in the interface.
  • While anyone with access to the record can view its contents, only the current workflow record owner(s) see the buttons that transition a record to another state. So only the Finance Reviewers see the [Issue Check] button.
  • The path a Record takes through the workflow depends on the actions taken by the decision-makers (owners) in each state.
  • A workflow owner is someone who can take action to transition a record to a new state.
  • Depending on the choices you make when you [#Edit an Intermediate State|Edit an Intermediate State]], either the record owner or the task owner (or both) can edit a record in that state. No one else is allowed to edit that record, even if their role and team permissions would otherwise allow them to do so.

1.3 Workflow States

A State indicates the status of a record. The state name can be any term that is meaningful to your business process.

Examples of typical workflow States:

  • Submitted
  • Pending
  • Under Review
  • Approved
  • Approved with changes
  • Resubmitted
Considerations
  • Each State is owned by at least one team member
  • States can be configured to allow the record to be edited by the Record Owner
  • Workflow decision makers are authorized to take action on the task or request, advancing the record to the next state in the workflow
  • Data Policies can be executed before or after a record transitions to a new state
  • Complex processes may route a record to several team members for approval

1.4 Workflow Actions

Actions determine what happens to a task/request record when it moves from state to state.

Example workflow Actions include:

  • Approve
  • Reject
  • Put on Hold, Set to Pending (another action)
  • Optionally, an action could be defined by a Calendar Data Policy. For example:
  • Approve after 3 days
  • Reject if a sent email is not acknowledged within 5 days
  • Escalate to Decision Maker’s manager if no change in status after 2 days
Considerations
  • Actions move records between states
  • Actions can optionally include user notifications
  • Advanced criteria can be designed to define whether an action can be taken on a record

1.5 Decision Boxes

Decision Boxes transition a record to different states, based on criteria. In essence, a Decision box selects a different processing path for the record.

For example, a Decision Box could submit a record for approval to:

  • A manager if the expense is less than or equal to $100
  • A director if the expense is more than $100
Considerations
  • All actions entering and exiting a decision box will have the same name
  • Only one action can enter a decision box
  • A minimum of one action must exit a decision box
  • Actions exiting a decision box can only enter a state; they cannot enter another decision box

2 Process Overview

Your first step will be to plan the workflow for a record type (object). You will launch the Workflow Designer and use it to define the workflow's states and actions.

2.1 Plan the Workflow

Before you start, map out your workflow using paper, a whiteboard, or a graphing tool. Working out the details in advance makes the process easier to implement. In addition, you may find ways to streamline existing processes, and even identify gaps in them.

As you map out your business processes, for every step you must:

  • Define the status of the request or task (State)
  • Create conditions for workflow routing (Decision Boxes or Data Policies for a state)
  • Identify the workflow owners in each state--the people who will be responsible for making a decision about the task/request (Workflow Initiator / Manager / Other)
  • Define actions for your processes (Actions)

2.2 Launch the Workflow Designer

The Workflow Designer is a graphical tool for specifying the states an object record can be in, which actions transition the record to a new state, and which users can take those actions. (It is available when you are viewing a custom Custom Object. It is not available for Built-in or CRM objects.)

Use the Workflow Designer to create a simple workflow:

WorkflowDesigner-Tools.png WorkflowDesigner-Orders.png

Or to create one that is significantly more complex:

Workflowdesigner.gif

To launch the Workflow Designer:

  1. Designer > Objects
  2. Select a Custom Object
  3. Click the Workflows tab.
  4. Click View link next to an existing workflow, or click [New Workflow] to create one.

2.3 Define States, Actions, and Decision Boxes

In the Workflow Designer, arrows indicate Actions that are part of the process. Round circles indicate workflow States. Diamonds indicate decision boxes.

  • States define the condition of the request
  • Actions define state transitions. (In a State, an action is modeled as a button a decision maker can press to transition the record to the next state.)
  • Decision Boxes create branches based on record criteria. (Each "action" arrow coming from a decision box specifies the criteria that cause that transition to occur. Such transitions occur automatically, without requiring a user to take an action.)

2.3.1 Start and End States

The Start and End states are different from other States, and provide the following options:

Start State
The Start State is the first state in a Workflow, and includes these items:
Title
Title of the workflow
Name
Name of the workflow
Workflow Initiator(s)
Users who are authorized to initiate this workflow
End State
The End State is the last state in a workflow, and includes these items:
Title
Title of the workflow
Name
Name of the workflow
Learn more: About Workflow Titles and Names

3 Manage Workflows

Lock-tiny.gif

Users that have the Customize Objects permission can manage workflows 

3.1 Create a Workflow

To create or edit a workflow:

  1. Click Designer > Objects > {object}
  2. Click the Workflows tab
  3. Click the [New Workflow] button
  4. Drag the Add State, Add Action, and Add Decision Box tools into the work area to build your processes.
  5. In the Properties section, complete the following information:
    Title
    Title of the workflow
    Name
    Name of the workflow
    Learn more: About Workflow Titles and Names
    Enabled
    Enable or Disable the workflow

3.2 Clone a Workflow

To create a copy of a workflow:

  1. Click Designer > Objects > {object}
  2. Click the Workflows tab
  3. Click the Clone link for the workflow you want to copy,
    Or visit a workflow and click the [Clone] button.

Notepad.png

Note: If an active workflow is cloned, both the new clone and the original workflow are in force. For any given record, then, there will be two sets of action buttons with the same names, that do the same thing (at least until one of the workflows is modified). To prevent the duplicate buttons, use the Workflow Start and End Dates described below.

3.3 Workflow Start and End Dates

When you create or edit a workflow, you can specify start and end dates in the workflow properties. Those dates determine when a workflow is in force, or active.

To define a cutover point for two workflows, make the start date for one the same as the end date for the other. (Both changes take place at midnight, or at time 00:00:01 of the date specified.)

3.4 Create New States, Actions, and Decision Boxes

The workflow designer area provides an interactive click-and-drag/drag-and-drop interface to add new States, Actions, and Decision Boxes.

To add a State:

  1. Hover the cursor over the Add State tool to display a tooltip with instructions on how to use the tool
  2. Click and drag the State tool to the work area and drop it into place
  3. In the Workflow Dialog Box, enter the requested information

To add an Action:

The Action arrow connects two states or connects a state and a decision box.

To connect two states:

  1. Hover the cursor over the Add Action Tool to display a tooltip with instructions on how to use the tool
  2. Click and drag the Action Tool to the work area
  3. Hover over the first state and drop the tool (release the mouse button)
  4. Move the mouse and Hover over the second state
  5. Click the mouse button to connect the action arrow to the second state
  6. In the Workflow Dialog Box, enter the requested information

To connect a state to a decision box:

  1. Hover the cursor over the Add Action Tool to display a tooltip with instructions on how to use the tool
  2. Click and drag the Action Tool to the work area
  3. Hover over the state and drop the tool (release the mouse button)
  4. Move the mouse and Hover over the decision box
  5. Click the mouse button to connect the action arrow to the decision box
  6. In the Workflow Dialog Box, enter the requested information

To connect a decision box to a state:

  1. Hover the cursor over the Add Action Tool to display a tooltip with instructions on how to use the tool
  2. Click and drag the Action Tool to the work area
  3. Hover over the decision box and drop the tool (release the mouse button)
  4. Move the mouse and Hover over the state
  5. Click the mouse button to connect the action arrow to the state
  6. In the Workflow Dialog Box, enter the requested information

To add a Decision Box:

  1. Hover the cursor over the Add Decision Box tool to display a tooltip with instructions on how to use the tool
  2. Click and drag the Decision Box tool to the work area and drop it into place
  3. In the Workflow Dialog Box, enter the requested information

3.5 Workflow Dialog Boxes

A Workflow Dialog Box opens when any Action, Decision Box, or State (including Start State/End State) is created or selected for editing.

3.5.1 Edit an Intermediate State

An intermediate state is any state other than the Start or End state.

  1. Click the State icon in the work area
  2. Fill in the information below.
  3. Click [Save]
Basic Information
Title - Title of the state (displays in the Workflow Designer GUI)
Name - Name of the state (like a field name. Used in APIs.)
Allow the Record Owner to edit the record in this state
Lets the record owner edit the record, even if not allowed to do so, ordinarily.
Learn more: About Workflow Titles and Names
Task Owners
These are the workflow "decision makers"--the Users who have permission to advance the workflow.
(In that sense, the original submitter is also a "decision maker".)
Choose one or more of the following:
  • Specific User - Choose a User.
  • Record Owner - Designate the Record Owner as a task owner.
  • Manager of Record Owner - Designate the record owner's manager.
  • Manager of Task Owner(s) - Allow the manager of any workflow owner to make decisions.
  • Users with a Specific Role - Choose a Team and an application Role.
  • Choose User at Runtime - The User taking the action chooses the Task Owner for the next state.
  • To make it easier for the user, specify the team the user can pick from.
  • By default, every user is listed.
  • Use a Class - A Workflow Task Ownership Class can be specified.
  • Lookup Target - For each field that is a Lookup to the User object, the name of that field shows up as a choice.
For example: If there is a User-lookup field labeled "Reviewer", then Reviewer shows up as a potential Task Owner.
  • Manager of Lookup Target - The manager of each user-lookup target is also listed as a potential Task Owner.
Checkbox options
  • Send Email - Task Owner(s) receive an email when a record transitions to this state.
  • Create Tasks - A task is created for the Task Owner(s) when a record transitions to this state.
  • Allow Edits - Allow the Task Owner to edit the record.
  • Post a Feed - Post a message to the Task Owner's feed.

Thumbsup.gif

Tip: It's a good idea to allow either the record owner or the task owner to edit a record in any given state, because no one else is allowed to edit a record in that state, even if their role and team permissions would otherwise allow them to do so. So if neither the record owner or the task owner is given edit permission, the record is uneditable until it is moved to a new state.

3.5.2 Edit an Action

  1. Click the title in an Action arrow in the work area
  2. Fill in the information below.
  3. Click [Save]
Basic Information
Title - Title of the action
Name - Name of the action
Learn more: About Workflow Titles and Names
Target State Task Owner
Use this option to automatically assign a previous task owner as the new Task Owner for the record.
  • 'As defined in Target State -' The list of task owners defined in the Workflow state remains in force.
  • 'Previous Decision Maker -' The User who took the last action on the record is the new (and only) Task Owner.
  • 'Manager of Previous Decision Maker -' The manager of the User who took the last action on the record is the new (and only) Task Owner.
For example:
  • A "More Information Needed" action can automatically assign the developer who sent a request to Q/A as the new Task Owner.
  • A "Could Not Reproduce" action can automatically assign the user who submitted a bug report as the new Task Owner.
Notifications
Optionally choose additional Users to Notify when this action is taken.
Criteria
Optionally create complex criteria to determine whether the action is available for a given record.
  • This section is shown for actions that transition directly to a state. It is not shown for actions that take the record to a decision box.
  • The action is only available when the criteria are satisfied. (They evaluate to TRUE.)
  • If the action is not available, the action button is not displayed
Criteria Builder
Use the Criteria Builder to define:

3.5.3 Edit a Decision Box

  1. Click the Decision Box icon in the work area
  2. Fill in the information below.
  3. Click [Save]
Basic Information
Title - Title of the decision box
Name - Name of the decision box
Learn more: About Workflow Titles and Names

3.5.4 Edit the Start State

  1. Click the Start State icon in the work area
  2. In the Basic Information section, complete the following information:
    Title
    Title of the state
    Name
    Name of the state
    Learn more: About Workflow Titles and Names
  3. In the Workflow Initiator section, complete the following information:
    Workflow Initiator(s)
    Specify users who have permission to initiate the workflow
    Choose from: Specific User, All Users, Users with a Specific Role
  4. Click [Save]

3.5.5 Edit the End State

  1. Click the End State icon in the work area
  2. Fill in the information in the Basic Information section.
  3. Click [Save]

3.5.6 About Workflow Titles and Names

In some workflow dialog boxes, the following options are available:

Title
Title of the workflow element
  • This title is displayed in the workflow
Name
Name of the element
  • This name is an internal name, used by developers in APIs
  • Name must contain only alphanumeric (a-z A-Z 0-9) and underscore (_) characters are allowed, no spaces

4 Best Practices

  • Finalize and test workflows with test records to verify the workflow process, then delete test records before adding real data.
  • Updating or changing a workflow process can have unexpected results if data records have been added to the object and their state is changing. For best results, disable all actions on the Object to ensure that all records are in states that exist in the modified process.

5 Workflow Processing by Email

This feature allows users to take action (such as approval or rejection of a request) by email, without requiring them to login to the platform user interface.

Prerequisite

5.1 Setting Up Workflow Processing by Email

To do workflow processing by email:

1. Add a Workflow.
2. Specify a decision-maker for each State.
3. Mark the "Send Email" checkbox for each decision maker.

When the workflow is activated, the decision maker in each State receives an email from "Company Name Workflow". The message contains important details related to the workflow.

To process the workflow:

4. Reply to the email message:
  • Include the desired Action in the first line of the email body.
  • The second line can include any comments related to this action.
  • The third line can contain the user ID or the user's full name.
    (This line is only processed if User Choice is specified as the the decision-maker for the next state. (The decision maker in the current state specifies who the decision-maker will be in the next state.)
  • Additional comments are ignored.

When the email reply is received, the record takes the action specified in the message.

5.2 Error Conditions

Invalid Action
If an invalid action is entered (or mistyped), the decision-maker will receive an email with the subject Invalid Action. Please enter valid action to process Workflow. The content of the email message will list the valid actions. To correct this action, Reply to the email message and select a valid action to update the workflow and move the record to the next state.
Lack of Workflow Owner in Next State
While processing the workflow, the platform also checks for the owner(s) of the next state of the workflow.
If the next state owner(s) are missing then user will get an email with subject Next State Workflow Owner(s) not Available. Please update the Workflow.
In this scenario, the workflow designer should edit the workflow to add owner(s) to the workflow before proceeding. After doing this they can reply to this email with proper action to move the workflow to the next state.

6 Templates in Workflows

When you automate a business process in a Workflow, you have the option to send email notifications based on state changes in the workflow.

The Templates option allows you to create personalized email messages that are sent automatically from the workflow. For example, a request is submitted for review, so an email notification is automatically sent to the requester.

If no templates are added to the workflow, the system default templates are used.

Each workflow can only have one Notification Template and one Global Workflow Template. A State-Specific Workflow Template can be used to override the Global Workflow Template for a specific state. Replies to the emails can also be used to trigger actions.

6.1 Create or Edit a Workflow Template

  1. Click Designer > Objects > {object}
  2. Click the Workflows tab
  3. Choose a workflow.
  4. Click the Notification Templates link.
  5. Choose an existing Template, or click the [New Template] button to add a new template
  6. Choose one of the following Template Types, then click [Next]:
    Notification Template
    Used to inform all record owners and additional users (specified in an action) of the state change
    Global Workflow Template
    Used to inform the workflow owners that an action from them is required
    State-Specific Workflow Template
    Used to inform the workflow owners that an action from them is required for a specific state (overrides Global Workflow Template)
  7. Compose the message template, completing the fields below.
    Template Information
    Template Type - Entered by default, based on your choice
    Template Title - Title of the template
    Description - Enter a description of the template
    Email Information
    Information in this section is used when Send Email is selected for a state:
    Subject - Enter a subject for the message
    Editor Type - Choose from HTML, Plain Text or WYSIWYG Editor
    Details - Provide the body of the message.
    Relay Feed Information
    Information in this section is used when Post a Feed is selected for a state:
    Feed Message - Enter the message to post
    Relay Feed Template - Enter the message to post
  8. Use the Template Variables to customize the message.
  9. Click [Save]

6.2 Template Variables in Workflows

Template variables can be used in both subject and body of a template. All the template variables related to the record are shown.

The Template Variables section provides a lookup to variables that will personalize the message.

In addition to the typical field-based template variables, these workflow-based variables are also available:

  • $workflow.id
  • $workflow.name
  • $workflow.title
  • $workflow.current_state - Name of current state
  • $workflow.previous_state - Name of previous state
  • $workflow.action_taken - Name of Action Taken
  • $workflow.available_actions_for_current_state - Names of available actions in current state
  • $workflow.current_state_title - Title (label) of current state
  • $workflow.previous_state_title - Title (label) of previous state
  • $workflow.action_title_taken - Title (label) of action taken
  • $workflow.available_action_titles_for_current_state - Titles (labels) of available actions in current state
  • $workflow.user_comments
  • $workflow.owner - Current record owner(s)
  • $workflow.history - History of workflow (a table)
  • $workflow.view_details_link - Link to view record details

7 Default Sample Templates

When you add a template, these sample templates are available for your use. Start with these samples, and customize your message to meet your needs.

7.1 Sample Notification Template

Subject: $record.name Workflow Has Been Updated
Hello,

The record $record.name has changed from 
    '$workflow.previous_state' state to the
    '$workflow.current_state' state.

Comments provided by previous workflow owner:
$workflow.user_comments

Current workflow owner(s): $workflow.owner.

Current workflow history:
$workflow.history

To view record details, click here:
$workflow.view_details_link


This is an automatically generated message. Please do not reply.

7.2 Sample Global State Template

Subject: Action required for $record.name
Dear $workflow.owner,

You are required to take action on the record $record.name

Comments provided by previous workflow owner:
$workflow.user_comments

To take action on this record, you can reply to this email 
directly with one of the following commands:
$workflow.available_actions_for_current_state

(Please keep the action as the first line and any 
comments within the second line)

Current workflow history:
$workflow.history

To view record details, click here:
$workflow.view_details_link

This is an automatically generated message. Any replies 
that do not have the proper actions will result in an error.

8 For Developers

Use Record Handling in the Java API to manage and support workflow processes.