Live Chat

Workflows trigger on Status Update

Workflows are an integral part of automating your business process, but they can be tricky. Today I wanted to talk about something that lots of you want to implement, triggering a workflow when the status of an activity or service ticket is updated. However, you can use this method to trigger a workflow when ANY kind of field is updated.

Note: We will be using Field Syntax in this tutorial. Learn more here:  Syntax Codes and Equations

First of all, you’re going to want to decide what data module you want this workflow to trigger on. I have a data module that tracks products (fig. 1). It has their names, a description, the price, and then a status dropdown that lets me know if the item is “Available” or “Out of Stock”. I want to get an email every time the status of an item changes so that I can keep track of what’s in stock and what isn’t.

Fig. 1 - The module that I'll be using

Fig. 1 – The module that I’ll be using

So, our workflow is going to look at each record every time it’s saved and say “did the status change from the last time we saved this item”. If it did, the workflow will email me.

To accomplish  this, we’re going to need some way to remember what the last status was, so we know if it was changed. In order to do that we are going to enlist the help of an invisible field.

To start, create a new field on your tab by clicking “New Field” at the bottom of the “Details Layout” pane in the admin section for this tab.

Give this field a name (“Display Text”) that will help you remember what it does, something like “Last Status”. You can then leave everything else as the default setting except for the “Sub Tab” dropdown. You’re going to want to change that from “Main” to “Not Displayed”. Doing so will ensure that this field isn’t visible to users in the front end of your site.

Fig. 2 - Adding a New Field

Adding a New Field

Next, you’re going to want to click on “System Preferences” in the “Administrator Options” pane. This will take you to the “System Preferences” pane and from there you can open up the Workflow Wizard (fig. 3). Decide what Workflow group you want your new workflow to be in (or create a new group) and then click the “Add New” button under that group.

Fig. 2 - The Workflow Wizard

The Workflow Wizard

Give your new workflow a name that will help you remember what it does like “Email on Product Status Change”. Then, under the “Type” dropdown select “When a record is updated”. This trigger will cause the workflow to look at records when they are updated (or “saved”).

Next, select the “tab” you want this workflow to monitor under the “Tab” dropdown. In my case I’m going to select the “Aaron’s Test” tab. We’re then going to want to create a new filter by clicking the “New Filter” button that will now appear below the “Tab” dropdown.

On your new filter click the “Add Criteria” button which will show the filter dialog window. In the first dropdown on the left select the invisible field that will be keeping track of what the last status was. In my case this field is called “Last Status”. Then in the second dropdown select “NOT Equal”.

Fig. 5 - A New Filter

A New Filter

In the third field (which is a text box) you will tell Ivinex to look at the current value of the status field. You do this by using the following syntax:

[Field: field_name]

In my case, the field name is “status”. You can find the name of your field by looking under the Field Display Options pane of a tab. It will be the first piece of data there, with the label “Field Name”.

Fig. 6 - The Field Name

The Field Name

Finally, you’re going to want to give your filter a name that will help you remember what it does. Once you do this, click the “Save” button.

Now you’re ready to start adding workflow actions. We are going to add two here. One is going to send an email, and the second is going to change the “Last Status” field to what the current status is so that we will know if the status changes in the future.

To create a new action, click the “New Action” button. This will give you a new green popup box. First enter a name for your action. I’ll call mine “Send Email”. Then you’re going to want to select the “Send email” action from the action dropdown. Doing so will give you a new “Details” section with an “Add New” button below it.

workflow_action

To start adding details for the email that we’re going to send, click the “Add New” button. You will then see two new fields, a dropdown, and a text box. In the dropdown select “Email Account”. The text box will then change to a dropdown and you will have a list of Email Accounts to choose from. Select any of the ones you have set up in your User Preferences.

Then you’re going to want to click the “Add New” button again and select “Email To” in the first dropdown. Then in the text box you’ll type in the email you want to send to. Then you’ll click “Add New” again and select “Subject” in the first dropdown and type the subject you want the email to have in the text box.

Lastly, you’re going to want to click “Add New” one more time and select “Email Template” from the first dropdown. The text box will change to another dropdown and a field with a magnifying glass. Click the magnifying glass to bring up a list of your Email Templates, and then click the “New” button in the top-right corner.

You can then give your Email Template a Title, type in a subject, and then a body in the rich text field. Just like on the filter, you can pull data from the product using the following syntax:

[Field: field_name]

I’m going to pull the “product_name” field and the “status” field for the body of my Email Template.

Fig. 7 - Email Template

Email Template

Once you’re done creating the Email Template, click the “Save” button. This will close the Email Template window and your action should now look like mine (fig. 7 above).

If you’re satisfied with your Workflow Action click the “Save” button to save and close this action.

Now, we’ve got just one more workflow action to create. We need to update the “Last Status” field to be the same as the “Status” field so that the next time this record is updated we will be able to tell if the Status has changed.

Fig. 8 - Workflow Action, Update Last Status

Workflow Action, Update Last Status

To get started, click the “New Action” button again. Give your action a name like “Update Last Status”. Then the action we’re going to select is “Update existing record”. You will then see a new dropdown labeled “Tab” that will list all the Tabs in your site. For this workflow you’re just going to leave it at the default, “–Triggering Record–“.

Then under the Details section click “Add New”. The first dropdown is going to list all the fields on the tab that you can edit with the workflow. Select the field that you’re using to track the last status, in my case its the “Last Status” field.

Then, in the text box you’re going to want to use a familiar syntax:

[Field: field_name]

Where “field_name” is the name of the status field, or “status”. This will set the “Last Status” field to the same value that the “status” field is set to. You can now click “Save” on this workflow action. This will close the Workflow action popup, and your Workflow should be looking similar to mine:

Fig. 4 - The completed Workflow

The completed Workflow

If you’re satisfied with the way this workflow looks, you can also click the “Save” button on it too. Now, every time the status of one of the my products changes it’s going to send me an email to let me know. You should be able to use this same method to implement similar processes for any data module and any field on your site.

Revisions

Tags: , ,

No comments yet.

Leave a Reply

%d bloggers like this: