Workflows enable you to automate repetitive tasks to help increase efficiency and ensure business processes are followed. With each workflow you set up in Sugar, you can define a set of conditions to be met and any combination of alerts and actions to trigger once the conditions are satisfied.
Beginning with version 9.1.0, each user’s license type (e.g. Sugar Serve) determines what functionality is available as described in the User Management documentation. The Workflow module covered in this article is not available in Sugar Serve and Sugar Sell.
Workflows trigger based on a record being saved in Sugar. This save event can occur in a number of different ways:
- Manual save by a user
- Mass update
- Updates through the API (SOAP or REST)
- Updates through the customer portal (Enterprise and Ultimate only)
- Another workflow
The last bullet above is the most important when designing workflows. Any time a workflow triggers, even if it is just to send an email alert, the target record is re-saved to allow for evaluation by other workflows. If you have two workflows with very similar conditions and no actions to alter those conditions after the workflow triggers, you could end up with a record that loops through two or more workflows continuously.
Every workflow must have at least one condition established in order to trigger. Workflows can trigger in one of two ways:
- Immediately upon saving the record
- After a specified amount of time has elapsed from when the record was saved
As you become more familiar with workflows, you will learn that there are specific workflows that will require a time elapsed set up in order to function properly. Regardless of which style of workflow you are setting up, the conditions in that workflow are evaluated immediately when the record is saved. If the conditions do not validate, then no further action is taken for that workflow and additional workflows are evaluated if necessary.
Lastly, it should be noted that in order for time elapsed workflows to function, the Process Workflow Tasks scheduler must be set to “Active” and should be executed at a high frequency. By default, this Scheduler is active and set to run every minute. For more information, please refer to the Schedulers documentation.
You need to first determine the type of workflow you will need. Will it be a workflow that will be triggered when a record has been saved or after a period of time has elapsed? Before you start building a workflow, you will need to identify the following:
- What is/are the condition(s) that need to be met in order for the workflow to execute?
- Do you want the workflow to fire on new, existing or both types of records?
- Once the condition is met, what action do you want the workflow to take?
- Once the action occurs, do you want a notification email to go out to an external recipient(s) and/or user(s)?
- Are you taking the proper precautions to ensure this workflow will not trigger other workflows in an unintended fashion?
It is best to map out your workflow processes before creating them in Sugar so you can understand the desired logic you want to achieve and identify any potential areas that will need safeguards to ensure your processes are performed as expected.
Now that you have a basic understanding of how workflows function and your design is mapped out, proceed through the following steps to set up a workflow:
- Go to Admin > Workflow Management.
- Mouse over the ‘Workflow Definitions’ tab at the top and select ‘Create Workflow Definition’.
- Enter a name for the workflow and select the execution style, target module, processing order, and applicable record types. Then click ‘Save’.
- From the workflow detailview, you will be presented with three panels:
- Conditions – Set up all your workflow conditions here. All conditions you create must be met for a workflow to fire.
- Alerts – Create custom alerts to send out when the conditions are met.
- Actions – With actions, you can update fields in the target record, update fields in a related record, or create a new record related to the target record when the conditions of the workflow are satisfied.
You do not need to have an alert and action created for each workflow. Once a condition is set on the workflow and you at least have one alert or action, your workflow will be ready to go!
Now that you understand the basics of setting up a workflow, you will want to review additional articles on more advanced tasks under our Workflow section such as creating alert email templates, defining a processing order, etc. so that you can leverage fully realize the potential of workflows! You can also review the Workflow Management documentation for more information.