Workflows can be used to automatize several actions in modules. Workflows are triggered by changes made in the target module’s fields – e.g. when a potential’s stage is changed to ‘won’ or when a customer’s assigned user has been changed. When triggered, the workflow can for instance send email, create an activity, run a wanted module tool, or possibly invoke a custom function.
You can add, edit and delete workflows in Settings → Workflows. These settings can also be accessed through module’s own settings.
In the main view you can see all the workflows in all the modules (see the picture below). The workflows can be filtered by module by selecting a module on the picklist on the top right corner. The existing workflows can be edited and deleted with the buttons in the Tools column and create a new one by clicking the New Workflow button.
When creating a new workflow you’ll need to first select the module where it is created. You can also use a template, if an earlier workflow has been saved as a template (in edit view, there is a Save as Template button for this). In the next view (see the picture below) the name and the time the workflow task is run are determined. The options for the time the task is run are the following:
- Only on first save – The task is run when the entity is created and only once.
- The first time all the conditions are met – The task is run only once when all the conditions are met (if the same entity meets the conditions again later, the task will not be run).
- Every time the record is saved – The task is run on every save while all the conditions are met.
Next you can determine conditions for when the workflow is run. A new condition is created by clicking the New Condition button and then you can determine a field (either from the module the workflow is in or from a module linked to it), an operator and a value for it (see the picture below). An unnecessary condition can be deleted later with the delete button on the end of the row. The relation between the conditions is always AND. This means that all the conditions need to be met for the workflow to take action.
It is also possible to make a condition that tracks the changes in a certain field. This is done by writing the value in a form #OLD.fieldname – for example if the billing street has changed: Billing street is not #OLD.bill_street. Comparing the value to the old one is always field-specific. With picklist, multipicklist or checkbox typed fields, you can enter the old value by clicking the button next to the condition row, which will then transform the value selection to a text field.
When the conditions are ready, the workflow must be saved with the Save button on the top right corner. The view then updates and a new section Tasks appears below the conditions. In this section the functions for the workflow are determined. A new function is created by clicking the New Task button and then selecting a function type. A workflow can have multiple functions. All of these functions do not necessarily need to be active at the same time, but the status of the function determines whether the function is run with the workflow or not.
The function type options are the following:
Invoke Custom Function
This function executes a customer and module specific method created by the system provider. The function is selected in the Method name picklist. In most cases this picklist is empty and instead the text “No method is available for this module” is shown.
Create Todo / Create Event
These functions create an activity. The determined fields vary a little by the activity – both todos and events require a task title and status in the summary section and a name, description and status. An event requires in addition an event type, start and end dates and times (see the picture below), whereas a todo needs a priority, due date and you can also choose to set notification sending on.
Run module tool
This function runs the selected module tool (see the picture below), when the conditions of the workflow are met.
This function creates a new email to the target group defined in the recipient field. In the recipient and body fields it is possible to use tags, which can be added from the picklists next to/above these fields (see the picture below).
All the function types have a checkbox Execute the task with some delay, which enables to set the run of the function happen after a certain time. The delay is always in days, but you can determine the amount of the days and from which time stamp of the workflow it is calculated from. Note, that along with this function the condition #CURRENT_USER reacts as an admin user.
If you want to create a similar workflow that you already have, you can save the existing one as a template and use it for the new one. Saving as a template is done by entering the edit mode of the existing workflow, clicking the Save as Template button and determining a name for the template. After this the template can be used when creating a new workflow. Note, that the template can be used only in the same module that the original workflow was in. Therefore it is not possible this way to copy a workflow from a module to another.