Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I am using Automation to populate Target Start Date with Start Date (I need it for Jira Advance Roadmap, but the cloud version doesn't offer a way to do it). I am trying to use the following JSON code:
{
"fields": {
"customfield_10022" : "{{startDate.format("yyyy-MM-dd")}}"
}
}
In my Jira instance this is the custom field for Target Start Date. I was trying to use smart value: {{Target start}} as it is suggested in this post: Date format smart value, but it doesn't recognize it.
I added the format condition trying to deal with this error message:
(The Target start must be of the format "yyyy-MM-dd" (customfield_10022))
I was able to populate in a similar way the Target End Date and the following works:
{
"fields": {
"customfield_10023" : "{{dueDate}}"
}
}
The previous referred question and this: Jira Automation to Copy Target Start / End to Cloned Issue, seems to be related, I was trying to following the suggestion but it doesn't work, and I spent about 1 hour in trial an error.
What is the specifics of this field that cannot be assigned the value from {{startDate}}?
I hope I will get some help from this community. Thanks
The error doesn't help too much, it is not really about the format of the date (in my case at least), but the fact that the value to setup is null, so it complains about the format of the date, which make you thing it is something related with the format, which is not. In my real case, I was updating the start date inside and Advanced Branch and then I did a Re-fetch issue data, then outside of the Advanced Branch I use the value assigned inside the Advanced Branch to update the Target start/end. The Advanced Branch works like an independent thread, so the re-fetch only has effect inside the Advanced Branch. Putting the re-fetch outside the Advanced Branch ensures it gets the start date recently populated, and then to assign a non null value to Target start date for example. I discovered this using New Action->Log Action and after several trial and error I found that is the reason.
Just to confirm that the following works:
{
"fields": {
"Target start": "{{start Date}}",
"Target end": "{{due Date}}"
}
}
and you can also use the customfield values:
{
"fields": {
"customfield_10022": "{{start Date}}",
"customfield_10023": "{{due Date}}"
}
}
the previous custom fields I took from the corresponding REST API information:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
The fields for Target Start and Target end are:
"customfield_10022": "Target start",
"customfield_10023": "Target end",
Previous approaches don't work if the value to set is null, it can be prevented as follows:
{
"fields": {
"Target start" : {{#if(equals(Start date,null))}}null{{/}}{{#if(not(equals(Start date,null)))}}"{{Start date}}"{{/}},
"Target end" : {{#if(equals(due date,null))}}null{{/}}{{#if(not(equals(due date,null)))}}"{{due date}}"{{/}}
}
}
I took the idea from this post: Automation Rule to null check custom field
Regards,
David
Wow. I have answered you with a full automation screenshot and how I made it working. Not sure if you received this answer and sounds its not here 🤦🏽♀️
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Patricia Francezi sorry I don't see it on the thread of your response. I updated my answer, finally I was able to find the root cause in my example. It is confusing, because the issue is not the date format, but the fact that the value to assign is null. This is what I found out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @David Leal
I am trying to set the Target end date with minusBusinessDays() and getting a format () error. Di you able to fix this issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Leal
This is due to the date formats are different in custom fields x system fields.
If you want to set the date in a custom field, try
{
"fields": {
"customfield_10022" : "{{startDate.format.jira}}"
}
}
If this works for you please accept my answer :)
And if not, let me know the new error so I can follow up with further assistence.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess this is one of the options I tried before, I tried it again and I am getting the same error:
TTSB-11 (The Target start must be of the format "yyyy-MM-dd" (customfield_10022))
Regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As per this doc https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html the smartvalue for this format is jiraDate
{
"fields": {
"customfield_10022" : "{{startDate.format.jiraDate}}"
}
}
Can you try again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same error, did you try on your end? just to make sure it works in another Jira instance. You can find your custom field via:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
and search by Start date.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same error here, i feel like that is related to type field.
im running some tests but if the type is "Date Time picker" and the other is only "Date Picker" is a clue.
Because the Date Time picker is expecting time information, i assume we need to "transform" the data from one to another.
I will let you know when i finish
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.