Hi,
I would like to create a custom label field value (number) from custom field date type (end date) as a month only by automation rule, f.e. from "MM/DD/YYYY" I need the label to be "MM", how to get a correct json?
Thanks for help,
Radka
Context is important for automation rule questions. Please post images of the following:
Until we see those...
You describe getting errors for invalid JSON, but in some cases shown you are not using any JSON which could cause that. Assuming you are using JSON in the additional fields / advanced edit...
You are trying to create a label, and that uses this JSON formatting, changing to use your custom field ID:
{
"update": {
"customfield_12345": [
{
"add": "my-new-label"
}
]
}
}
And, the new label you are trying to add uses the format() function, which includes quotation marks. As a result, that would nest the quotation marks, leading to invalid JSON.
The expression could instead add the asJsonString function at the end to eliminate the need for the surrounding quotation marks:
{
"update": {
"customfield_12345": [
{
"add": {{issue.customfield_10081.format("MM").asJsonString}}
}
]
}
}
Kind regards,
Bill
Hi @Radka Svobodova,
You can achieve this in Jira Automation by using smart values and a date formatting function. If your custom date field is called End date
, you can extract just the month and set it into a label/number field.
For example, in your Edit issue → Labels (or number field) action, use:
{{issue.customfield_XXXXX.format("MM")}}
Where:
Replace customfield_XXXXX
with the actual field ID of your End date field.
format("MM")
returns the month number (01
to 12
).
If you need the short month name (e.g. Jan
), use format("MMM")
.
For full month name, use format("MMMM")
.
So if End date = 08/28/2025
, the smart value {{issue.customfield_XXXXX.format("MM")}}
will give 08
.
To find your field ID, go to Automation → Audit log after running the rule once and expand the “View issue data” section—it will show the exact smart value name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the source of the content you posted?
As a reminder, when posting bot / AI-generated content, the source should be disclosed in the post's text. For more information, please see the Community Guidelines:
https://community.atlassian.com/forums/custom/page/page-id/rules-of-engagement
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Radka Svobodova ,
you could use smart value for Date format {{[date].[dateformat]}}.
replace [date] with a smart value/variable of the input date you want to format, and for date format use: format("MM").
So let's say you have a date field called MyDate (example: customfield_1234), it would look something like this:
{{issue.customfield_1234.format("MM")}}
regards,
Benjamin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I actually tried that, and it still gives me not valid json
I guess I need mor to transform it to string to add to label type field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suggest you to use log actions so you can check what results are you getting from different smart values.
At the end, there should be no problem editing label field with the new value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.