This article describes how to set up a Sugar Workflow to address a common business scenario. Sugar Workflows provide powerful procedural capabilities to implement business-level logic for common CRM scenarios. Sugar handles two main types of workflows: one that is triggered when a field or record changes, and one that is triggered when time elapses without any activity. The scenario we will accomplish in this article is as follows: When an Opportunity reaches a Sales Stage of “Negotiation/Review” automatically create a task assigned to the Legal team regarding the need to review and approve the Opportunity and related contracts. We will be basing our scenario using using standard demo data with one exception: we will assume a team of “Legal” exists for assignment purposes. You can use the outcome of this scenario as a basis for other more sophisticated CRM business scenarios like:
- When a Case status changes, send a notification email to the customer who submitted the case
- When an Account record’s Revenue field exceeds some threshold, alert the team’s manager
- When a new lead is created using the “Web to Lead” form, send an email alert to the assigned user and send a “thank you” email to the prospect saying that someone from the sales team will contact them shortly.
In addition to these data-based scenarios, you can also create workflows that automate time-elapsed scenarios, such as these:
- If the status of a Case with “High” priority has not been updated in 4 hours, send an alert to the person who is assigned to the case.
- If an Opportunity has not been updated in 2 weeks, send an alert to the manager of the person who is assigned to the opportunity.
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 used in this article is not available in Sugar Serve and Sugar Sell.
Steps to Complete
Creating the Workflow Definition
Log in to Sugar as an administrator. If you haven’t already done so now is a good time to establish the “Legal” team by navigating to the Teams page within the Admin home page.
- Click the “Admin” link on your homepage to access the Administration: Home page.
- In the “Users” section, click Team Management
- Click “Create Team”
- Enter “Legal” as the Team Name and a description.
- Add the appropriate users for your new “Legal” team
Now it’s time to create the actual Workflow definition. We start by establishing the Workflow definition.
- At the Administrator: Home page, in the Developer Tools section, click Workflow Management.
- Click Create Workflow Definition
- Establish the following values:
- For the Name field use “Alert Legal team of need to review an Opportunity”
- Leave Execution Occurs as “When record saved” indicating we want to execute the workflow when the record (in this case any given Opportunity) is saved
- The Target Module will be “Opportunities” since this is the module of interest in this scenario. Select “Opportunities” from the dropdown list.
- Leave the Processing Order, Status, and Applies to fields to their defaulted values.
- Enter an appropriate Description for notational purposes.
- Click Save
At this point we have created a new Workflow definition indicating that some action will take place when a new or existing Opportunity record is saved. We haven’t yet defined what is to occur and under what conditions. This is the next step. Before going on it’s important to note that this Workflow will execute (even though at the moment there’s nothing for it to do) no matter how an Opportunity is saved–by a Sugar user, by an import, or any other means. Now it’s time to specify what the Workflow will actually do when executed and under what conditions it will execute.
After saving the Workflow Definition you are allowed to specify Conditions, Alerts and Actions. Since we don’t want to “fire” our workflow every time an Opportunity is saved, we need to limit the scope of our definition. For this we establish the conditions under which the workflow will execute. Returning to our scenario our condition is highlighted below in bold: When an Opportunity reaches a Sales Stage of “Negotiation/Review” automatically create a task assigned to the Legal team regarding the need to review and approve the Opportunity and related contracts. Now we can build the Workflow Condition that addresses our requirement:
- Under the Conditions section of the Workflow definition, click the Create button.
- A dialog box appears with various options. Our interest is in a particular field (Sales Stage) that contains a specific value (“Negotiation/Review”) so the best option for this scenario is:When a field in the target module contains a specified value.Note that target module in this context is Opportunities as we have previously established.
- Click Next to advance to a dialog box where you can specify the field in question. In our case the field in question is Sales Stage. After you select “Sales Stage” from the list of fields, you can (in a new dialog box) specify a qualifier of “Equals” or “Does not equal” and an associated value. Our scenario hones in on Sales Stage equaling “Negotiation/Review” so we will use Equals and choose Negotiation/Review from the associated values.
- Clicking Save after establishing the qualifications and Save once more at the field definition dialog box returns you to the Workflow definition space.
- A summary of the workflow condition you just built now appears in the Conditions section.
At this point we are nearing completion of our scenario. All that’s left to do is specify what it is that the Workflow will do when it is “fired”. For this we need to specify the Actions we wish to take place.
Returning once again to our scenario our action is highlighted below in bold: When an Opportunity reaches a Sales Stage of “Negotiation/Review” automatically create a task assigned to the Legal team regarding the need to review and approve the Opportunity and related contracts. Perform the following steps to create the actions to fulfill our business scenario.
- Under the Actions section of the Workflow definition, click the Create button.
- A dialog box appears with four choices. Since we wish to create a task record in our scenario the option entitled Create a record in a module associated with target module is the best option. Note that our scenario implicitly wishes to associate the new Task with the Opportunity which is exactly what this option provides.
- Click the Create a new record prompt and, in the new dialog box, specify “Task” from the dropdown list of available modules, and Save. Now, click Next to specify values you wish to establish in the Task record created on a user’s behalf.
- You are now presented with a dialog box that allows you to specify default field values for the new Task. Required fields already appear at the bottom of the list. Additionally, click the checkbox Modify the field: Team Id to enable this value to be specified. Identify as many fields as required. Each field you select also appears at the bottom of this dialog box.
- Once you’ve indentified the field(s) of interest it is now time to establish the value. You do so by clicking the field name in the list of fields you’ve identified, once for each field.
- Use “An Opportunity requires your approval” for Subject
- Use “Legal” for Team Id from the available dropdown list.
- Click Save when you have established all the fields and their values.
- Like before, when you established Conditions, you’ll be placed back in the Workflow definitions area. You’ll now see a summary of the Actions you just specified.
You’ve now created the Workflow definition to meet your business requirements. Now it’s time to test the workflow to ensure it functions properly. A simple way to accomplish this is to update an Opportunity after setting Sales Stage to “Negotiation/Review”. Be sure to also test the inverse condition (what happens when Sales Stage is set to something other than “Negotiation/Review”). Another test is to check that an Opportunity with a Sales Stage already containing the value “Negotiation/Review” is saved once again with “Negotiation/Review” – a second task should not be created in this scenario.
In your testing you likely noticed that another Task is created even though the Sales Stage remained “Negotiation/Review” (did not change) when the Opportunity was saved. You don’t want your Legal team to be assigned another Task in this scenario. To prevent this from occurring we need to specify an additional condition.
- Under the Conditions section of the Workflow definition, click the Create button.
- A dialog box appears with various options. Our interest is in a particular field (Sales Stage) changing so the best option for this scenario is:When a field on the target module changes.
- Click Next to advance to a dialog box where you can specify the field in question. In our case the field in question is Sales Stage. After you select “Sales Stage”.
- Click Save.
The Conditions section contains two conditions. Only when both conditions are met will the workflow fire. Thus, not only must the Sales Stage field change value upon save but it must be a particular value in order for the overall condition to be met.