In this exercise, you'll learn how to format the information from the Date Picker and Number fields to be printed in a document.
To start, we are going to create a custom field of type Number Field and name it Price.
Since Jira has native Date Picker fields, like Created or Updated, we don't need to create one of those for this exercise.
Formatting Date Fields
If you are exporting a date field, you can set the format of how the date is displayed on the generated file. All the patterns included by the SimpleDateFormat Java API are supported.
${dateformat("<Format>"):<Field name>} |
You can use this mapping in different ways.
For instance, if you want to print only the date and not the time, use ${dateformat("yyyy-MM-dd"):Created}. If you want to print the date and time, use ${dateformat("dd-MM-yyyy HH:mm:ss"):Created} instead.
You can see here more details about formatting Date Picker fields.
Formatting Number Fields
If you are exporting a number field, you can set how the number contained in it is displayed in the generated file. All the patterns included in the DecimalFormat(String pattern) Java API are supported.
|
Check the documentation here for more details about formatting Number fields.
In the issue, populate the Created Date, Updated Date fields, and the Price custom field.
The native and custom fields with the notation are listed below.
Below is a sample of how the mappings will be displayed in a Word template:
This Template has:
- a Header with an Image
- Headings
- Text styling
Below is a sample of how the generated file will be populated:
If you like this exercise, please leave a comment or a . Your feedback is very important to us.
Thank you in advance.
Enjoy our product.