In later versions of JSCAPE MFT Server, you'll find a graphical Expression Builder in the Trigger Conditions step of the Triggers module. It's designed to make writing trigger conditions much easier and faster. Let me show you how it works.
Let's say we have a trigger that we'd like to respond to specific file upload events. To be more specific, we'd like it to respond to file uploads carried out by user accounts that have either 'mktgacct' or 'itacct' in their usernames. In this example, these are indicative of users from our Marketing or IT departments. In addition to that condition, we'd also like to restrict the response further to a specific filename.
Watch the video
Would you prefer to watch a video version of this tutorial instead? You can play the video below. Otherwise, just skip it if you wish to continue reading.
That would translate to a trigger condition that would more or less look like this:
Name = "somefile.png" AND (Username # "itacct" OR Username # "mktgacct")
Name - the filename of the uploaded file, and
Username - the username of the account that uploaded the file
Notice that we've grouped together the two usernames in an OR expression. That's because, as stated earlier, this trigger may respond to either of the two kinds of usernames. So, if this trigger condition evaluates to TRUE, then the succeeding trigger action or actions would be executed.
Previously, when you would construct a trigger condition to narrow down to specific trigger events for a particular trigger, you would do most of the construction manually, spending most of your time typing in your desired expression in the Expression box.
Now, here's how you would do that with the Expression Builder. Before we proceed, let me first show you a preview of the finished product, just so I can point out the various components of the Expression Builder. The Expression Builder basically consists of the following:
1. Rules - These are essentially relational or arithmetic expressions. You add a rule by clicking the Add Rule button.
2. Groups - These are basically groups of expressions. You add a group by clicking the Add group button and then add rules to that group by, again, clicking the Add rule button.
Notice that you can also delete rules and groups by clicking their respective delete buttons.
3. AND and OR operator toggle switches that allow you to choose AND or OR operators for building logical expressions.
Ok, now that you're familiar with the parts of the Expression builder, let's enter the first part of our trigger condition.
We start by selecting the Name variable from the first drop-down list. As you'll see as you expand that list, it contains all variables associated with the File Upload event, which is the event type we used for this trigger. Of course, this list will change depending on what event type you pick when you create your trigger.
Next, select equal from the second drop-down list. This list contains all the operators you'll need in writing an expression, like equality and relational operators.
Last, type in the value that you would like to compare with the first operand, i.e. the Name variable. So, let's just enter 'somefile.png', assuming we only want this trigger to respond to an uploaded file named somefile.png.
Notice how the Expression box automatically populates and changes as you manipulate the Expression Builder. If you want to make sure the Expression box is fully populated with the equivalent expression just click anywhere on the dialog window. So, if everything goes well, you should see something like this:
Let's now proceed with the second part of our trigger condition. As the second part is a group of expressions, just click the Add group button to add a new group. Once you do that, a new group will be automatically added to the Expression Builder.
Let's now compose the first expression of that group. Select Username from the first list and contains from the second list, and then enter itacct into the text box.
To compose the second expression, click the Add rule button first. And then once the new rule is added, select Username from the first list and contains from the second list, and then enter mktgacct into the text box.
One more thing. The two expressions in this group are supposed to be part of an OR logical expression. So click the AND/OR toggle switch to set it to OR.
You can then click anywhere on the dialog window to make sure the Expression box is populated with the complete expression. If you want to delete a group or expression, just click its corresponding Delete button.
Note that you won't be able to use Functions or regular expressions when using the Expression Builder. So, should you wish to use those, just click the Override checkbox and you'll have more control in composing your desired expressions. Once in Override mode, you can manually enter expressions in the Expression box as well as use the buttons below it that were disabled when Override was unchecked.
If all is good, you can click on Next to proceed to Step 3 of the trigger creation process where you'll be adding a trigger action or actions.
That's basically all there is to know about the new Expression Builder. But stay tuned for our next post, as I'll be discussing about another big improvement in JSCAPE MFT Server v12 — the redesigned Trigger Action workflow. Catch you then!
Try this yourself
Would you like to try this yourself? Download the FREE, fully-functional Starter Edition of JSCAPE MFT Server now.Download JSCAPE MFT Server Trial