...
Go to Profile > Project Mapping > Rules
Press Create rule to create a new rule
Once created, press the Edit (Cog Icon) Button.
Once in the Rule configuration press the Edit button to configure a Rule.
Now Press Script Configuration
Once press you will now see the configuration for the Script Rule.
Once the Script has been configured, you will then need to go to Rule Configuration and press Active as this will result in the Rule being enabled.
Testing Script Rule
...
Testing Script Rule
Once the Script has been added, Select a Test Case.
Press Run
Once processed there will be an output of the Results. Allowing you to review if the correct outcome has occurred. For example below.
Results Output
Within the Results output there is 3 sections. These sections are:
Success or Error - This is used to define if the Script was able to be processed correctly or if there was an error with the script. This section also defines if the Test Case was a match or not.
Script Output - This is where the Print values are output, allowing for additional information to be displayed. e.g. using
print("Sender is correct: " + message.getHeader('from'));
Script Evaluation Time Metrics - Used to identify how long it took to evaluate the script against the selected Test Case.
How to Rule as a Match
In order for the Rule to be seen as a match you will need to ensure that the Script defines that there was a match. This is done by using the following line within the Script.
Code Block |
---|
setMatch(true) |
For example, the condition below will only set the rule as a match if the sender is “ryan@thepluginpeople.com”.
Code Block |
---|
if (message.getHeader('from') == "ryan@thepluginpeople.com")
{
print("Sender is correct: " + message.getHeader('from'));
setMatch(true);
} |
Script Examples
See the following page for some example use cases: Use Script Rule