Summary
Script rules allow custom logic to be used to determine a matching project mapping via user-made scripts. This enables routing of emails in event the most complex business. Support for JavaScript code is built in - alternatively it is possible to install additonal runtime engines to be used instead.
Script rules are an advanced feature and therefore at least a basic understanding of JavaScript and Project Mappings is required in order to use the feature effectively.
For more detail and examples see: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/223739905/Use+Project+Mapping+Script+Rules#Script-Rule-Context
Creating a Script Rule
Go to Profile > A Non-default Project Mapping > Script Rules and press New Script Mapping.
This will then open the configuration for the New Script Mapping. Here you enter the relevant Script and Language and then press Save.
Now you will be able to configure the other tabs within the Script Rule. e.g. Issue, Email and Custom Field Defaults.
Once everything is configured and saved, you will be able to view the Script Rule config within the Script Rule Summary.
Configuration Options
Show script context
This displays the context for script rule execution.
Script
This is where the custom script is entered. This script is used to determine whether the email should be matched by this Script Rule.
Language
This defines the language that the Script Rule will use when creating and running the script. Support for JavaScript (Nashorn) code is built in - alternatively it is possible to install an additional runtime engine which can be used instead.
See the following page for information about installing additional scripting languages: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/241106948/Install+a+Scripting+runtime+Engine+Nashorn+Groovy+Graal#Summary
Script rule validation
Test Case
This is where you select the Test Case that should be used to test the Script Rule to ensure that it is functioning correctly. Only Test Cases that have this Profile selected will show here.
Check Rule
This will run the script rule against the selected Test Case. Once run it will display whether there was a Rule Match and will display any Result Map values.