Velocity Script Examples
Summary
Below are some example Velocity Scripts that can be used when setting a Dynamic Custom Field Default.
Storing catch email address information in issues
Velocity reference |
| Description |
---|---|---|
$catchEmailAddress | Contains the email address | |
$matchingRecipient | Shorthand for | |
$matchingCatchEmailAddress | A string representing the configuration responsible for finding the catch email address. Depending on what was configured in the profile, this could be a static address or a regular expression. |
When using this custom field value later (e.g. in templates):
Setting a Date field 1 day in the future
To demonstrate this, here is a walk through:
Create a Velocity Custom Field Default
Default custom field values are set in Project Mapping and resolved when an email is processed.
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 date field, select Velocity and when you want the field to be updated.
Enter the following script:
$longVal
is defined as a variable, (with the value of the current time in milliseconds, plus 24(hours)*60(minutes)*60(seconds)*1000(millis) = 8640000), then the$dateFormatter
is in charge of rendering the date generated from$jemhDateUtils.createDate
Screen will look like: