Using JavaScript to set custom fields
User-provided JavaScript code is run, allowing custom logic to be used when setting a custom field. See more JavaScript examples.
Setting the Value
To set the relevant value on the Custom Field you would need to include setValue(fieldValue)
within the script once the value has been extracted.
JavaScript Context
API | Notes |
---|---|
| Sets the value for this Custom Field. Parameters
|
| 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 has been associated with an existing issue, this contains the issue data. Format is as per the Get Issue response from the Jira REST API. |
| Adds output that is recorded during execution and shown in the processing report. Parameters
|
| Searches within string values for matching content.RegExp - JavaScript | MDN |
Steps to set create a JavaScript Custom Field Default
Go to Profile > Project Mapping > Issue > Edit
Under CUSTOM FIELDS DEFAULTS you will see the available custom fields for the project mapping's project.
Find your custom field, select JavaScript and when you want the field to be updated e.g. On Create/Comment.
Enter the relevant script within the text-box
Testing JavaScript Custom Field Default
Once the relevant Script has been configured, select a Test Case within the Select Box and 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.