Overview
The workflow engine is used to run a list of "Activities" when a "Trigger" is met. Users can use this module to customize how, when, and what activities generate automatically in the system.
Activities:
An Activity refers to any of the following:
Triggers:
A Trigger refers to any of the following:
Create your first workflow:
This workflow is going to be quite simple. When a work order status changes to "Closed, Completed", then notify the relevant administrators, and send them a summary of the work done.
1. To open the workflow page click Settings, and Workflows. Click New to create a new workflow
2. We're going to name the workflow "Send a Work order summary when completed"
We'll choose I would like to Send a notification to a user(s) or group(s), and Every time a Field was changed to a specific value. Once finished click OK.
3. The next window allows us to add more details to our triggers and activities. Let's have a precise look at our trigger! Open the Trigger tab. As we previously chose, the workflow is triggered when a field is updated to a specific value.
Click on the Field dropdown, expand the "Work Order" table, pick the Work Order Status id, and then pick the right value. We'll choose Closed, Completed in our case.
4. Next, click Activities. This is where we define what happens when the workflow is triggered. A line is already here. It's the notification that we chose on our first step. Click on it to open the details.
5. Clicking on the existing line will open a new window where we can define what information gets sent, and who it gets sent to.
6. I'll pick Augustin in the Recipients as he is the admin, and he needs to have a look at those work orders.
I'll choose a Subject :
summary of Work order <ma:expr expr="rec.strCode"/>
and a Body :
<div style="padding : 30px;">
<p>
<b>
Hi <ma:expr expr="rec.strAssignedUsers"/>!<br />
Here's a summary of your work order !
</b>
</p>
<p>
<b>WO</b> : <ma:expr expr="rec.strCode"/><br />
<b>Priority</b> : <ma:expr expr="rec.findRelatedRecord('intPriorityID').strName"/><br />
<b>Maintenance Type</b> : <ma:expr expr="rec.findRelatedRecord('intMaintenanceTypeID').strName"/>
</p>
<p><b>Tasks</b></p>
<table style="width:100%">
<tr style="border-bottom: 1px solid black; font-weight: 400;">
<th>Task Description</th>
<th>Time Spent</th>
</tr>
<ma:forEach var="wot" expr="rec.findRelatedRecords('tblWorkOrderTask', 'intWorkOrderID')">
<tr style="border-bottom: 1px solid grey">
<td><ma:expr expr="wot.strDescription"/></td>
<td><ma:expr expr="wot.dblTimeSpentHours"/></td>
</tr>
</ma:forEach>
</table>
</div>
7. Click Preview, pick a work order as an example, and you'll see the email that goes out :
8. The final step is to activate your workflow. This can be done by clicking the Inactive button highlighted below.
9. Your Workflow is now active, and a work order summary will be sent to your predefined user.