Script Field Processor
Summary
When JEMHC Processes messages, the content (subject/body) can be subjected to Field Processors, which are specialised parsers. The script field processor allows you to use this information to create custom JavaScript conditions within JEMHC.
How to enable
Go to Profile > Project Mapping > Field Processors
Press edit Edit in the top right corner.
Then select Yes on the Script Field Processor.
You will now see that a section is shown allowing you to configure the Script Field Processor.
Testing the Script
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:
Directive Values - This is a list of Custom Field values that have been set by the Script. e.g. using
resultMap.set('labels', "label1,label2,label3,label4");
Script Output - This is where the Print values are output, allowing for additional information to be displayed. e.g. using
print(`Body: \n${message.getBody()}`);
Script Evaluation Time Metrics - This is used to identify how long it took to evaluate the script against the selected Test Case.
Available Script Context
The another ticket with different subject “ATH201125 –405034 – Visit Early Termination (A)”. It is showing in the auditing page but the subject was never processed & new created was not created , that is what I mentioned instead of creating new ticket , the existing ticket TDAS-55011 was commented. API | Notes |
---|---|
| Get body content of email. Not available for preprocessing task. |
| Gets the Subject content of email. |
| Get all headers of a message. |
| Get value of a message header Parameters
|
| If the email being processed is commenting on an existing issue, then this context will contain the field values for the related issue. Allowing for this data to be used within the Script. Format used is as per the Get Issue response from the Jira REST API. Note: This is only available within the Script Custom Field default and the Script Field Processor. For more info about using Issue Data see: https://thepluginpeople.atlassian.net/wiki/spaces/JEMHC/pages/3861676043/Manipulate+Issue+data+in+Scripting+features#Showing-the-JSON-object-Values-and-structure |
| Adds output that is recorded during execution and shown in the processing report. Parameters
|
| Set the processing outcome of the script Parameters
Note: |
| Used to set issue field values. See Map - JavaScript | MDN for usage. |
| Searches within string values for matching content. See RegExp - JavaScript | MDN for usage. |
Script Examples
See the following page for some example use cases: Use Script Field Processor
Script Exceptions
TimedOut exception
When you see the following exception it means that the Script took too long to complete and as a result JEMHC stops the Script from running resulting in the following exception.
LambdaException
This exception occurs when the script is too large. Scripts must be less than 6291456 bytes (6.29MB) in order to run.
SyntaxError
This error means that there is something wrong with the script which is stopping it from running. Typically a character is missing which makes the script invalid. e.g. Missing a “)”.
ReferenceError
This error is used when you try an use a script Context that does not exist. e.g. when using “prin” instead of ”print”.
TypeError
This error occurs when you try and use a Function that does not exist within that Script Context and as a result cannot be used.