How to create a Scripted Pre-Processing Task
Summary
The Scripted Pre Processing Task allows you to change message with a Velocity or ECMA Script (aka Javascript).
The objective of the scripted task is to modify the message before running the standard JEMHCloud process.
Velocity templating language and Javascript are available but Javascript is recommended.
Some technical ability is needed to create and maintain scripts you create!
How to use
Pick the type
Pick the Test Case
Make some asserts (language specific format) on the outcome
Adding a Test Case
A Test Case can be added by either creating your own email within the Test Case box or by selecting an existing Test Case from the Load Test Case list.
Using the Test Script
A way to verify that your email is being modified as expected is creating a Test Script that tests your main script. The test script will assert how the test case email looks after your script is executed against it. The test script is composed of a list of assertions. An assertion is a condition that needs to be true in order to pass.
You can test the script before saving by pressing the validate button. This will allow you to solve any issues before saving the change. If you attempt to save a script which contains issues, these issues will be reported and you will not be able to save your script until you have resolved them.
It's highly recommended to test your script by adding many assertions to verify it works properly. If an assertion fails, the error below the script editor will show you the line and column number in the script that is failing. The presence of a Test Script is required.
Test Script examples
For Velocity examples, see Velocity Scripted Pre-Processing Examples.
For ECMA Script examples, see ECMA Script Scripted Pre-Processing Examples.