Hi,
I have the following date fields:
I am trying to create a very simple value change automation.
When I change or set a date in the "Target start" field, I would like the "Target Discovery End Date" field to display a date that is 3 days later than the date in the "Target start" field.
I am using the following Smart values expression, but it is not working:
{{issue.Target start.plusBusinessDays(3)}}
What am I doing wrong? What is the correct way to write this expression?
Scenario or example:
If I add or change the "Target date" to 11/10/25
I want the "Target Discovery End Date" to display 11/13/25
They are both date fields.
Thanks,
Shahriar
Hi @Shahriar
When the advanced planning / roadmap fields (e.g., Target start) are supplied to automation rules, I believe they are plain text. They must be converted with the toDate function for use with the date / time functions:
{{issue.customfield_13205.toDate.plusBusinessDays(3)}}
Kind regards,
Bill
Hi @Bill Sheboy ,
That worked! You are awesome! Thank you so much, Sir.
I didn't know we had to add "toDate function" for such types of fields that come with JIRA Plan, aka Advanced Planning and roadmap.
Thank you so much for your help!
- Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Looks like I have run into another problem with this. I created an additional date field called "Target Define End Date", which I want to display 3 business days after the previous date field, "Target Discovery End Date", but it is not adding correctly. Sometimes it is showing a day before or a day after.
Target Discovery End Date = customfield_19809
Here are two examples,
I set the "Target start" to 13/Jan/26.
Using the expression {{issue.customfield_13205.toDate.plusBusinessDays(3)}}
The "Target Discovery End Date" displays 16/Jan/26, which is correct.
Using the expression {{issue.customfield_19809.plusBusinessDays(3)}}
The "Target Define End Date" displays 20/Jan/26, which is not correct; it should display 21/Jan/26
I set the "Target start" to 12/Jan/26.
The "Target Discovery End Date" displays 15/Jan/26, which is correct.
The "Target Define End Date" displays 21/Jan/26, which is not correct; it should display 20/Jan/26
Can you please help me understand why this is happening and what I need to change?
I didn't add the "toDate" for the next expression because that is only for the roadmap field "Target start".
Thanks,
Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please add some Log actions to the rule to confirm what is in the smart values for the fields before changing them. For example:
Target Discovery End Date = {{issue.customfield_19809}}
Next, what I believe is happening is you are changing one field, then trying to use the updated value in a later rule step. When you want to do that, the rule needs to add a Re-fetch Issue Data action to reload the information. For example:
After doing that...please post an image of your current, complete rule and the audit log details showing the rule execution. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Adding the re-fetch issue data action did the work! Thank you again so much!
I have one more problem with the very last field.
My very last field is the "Target end", which is the field that came with JIRA Plan/Roadmap, just like "Target start".
I am trying to get that field to display 3 days after the previous date field in my rule, which is the "Target Define end", but I am having difficulty writing the expression.
Here is what I have, but it keeps giving me parsing and JSON errors.
I tried several ways, but no luck:
{"fields": {"customfield_13205": "{{issue.customfield_19810.toDate.plusBusinessDays(3)}}"}}
{"fields": {"customfield_13205": {{issue.customfield_19810.toDate.plusBusinessDays(3)}}}}
{"fields": {"customfield_13205":[{"issue.customfield_19810.toDate.plusBusinessDays(3)"}]}}
Thank you so much in advance! Much appreciated!
Screenshot attached from the audit log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When using JSON to update a date field for a rule, the value must be text in the jiraDate format. Please try this for the JSON expression:
{
"fields": {
"customfield_13205": "{{issue.customfield_19810.toDate.plusBusinessDays(3).jiraDate}}"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy , I tried using the JSON expression you provided, but it didn't work. I get the parsing date string error in the log. I will provide a screenshot.
I made a mistake in my earlier message and expressed it with the custom field ID, but that isn't the problem. The custom field ID for the Target end is 19810
Thank you so much for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First, please confirm the custom field ID. Earlier you noted it was customfield_13205 and now you show a rule with a different one: customfield_13206.
Next, please show an image of your complete rule and an image of the edit issue action for that last custom field.
And, earlier I described adding some Log statements to write values to the log and confirm what is happening. Please add these and re-test your rule, posting the audit log afterwards.
customfield_13205: {{issue.customfield_13205}}
customfield_19810 with toDate: {{issue.customfield_19810.toDate}}
customfield_19810 incremented: {{issue.customfield_19810.toDate.plusBusinessDays(3)}}
customfield_19810 incremented and formatted: {{issue.customfield_19810.toDate.plusBusinessDays(3).jiraDate}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
I will follow the instructions you provided and get back to you with all the information you asked for. Thank you so much for your patience.
Thanks,
Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
I added the logs you instructed. I've never added logs to the rule before; this is the first time. I hope I did it correctly. Please let me know if I need to make any changes or corrections, and I'll resend. I added all the screenshots and images with the other information you requested. Please let me know if I've missed anything.
Thank you!
Thanks,
Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that testing, @Shahriar
Based on the log entries you see, either those are not the correct smart values for the fields or they are not supported by automation rules.
To check if the fields are supported in rules, please use this how-to article: https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html
The basic steps are to:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Thank you again so much for looking into this for me.
I am confused as to why those would be incorrect smart values. I will check the link you sent to see if those fields are supported or not by the automation rules. It would be disappointing if the automation rule doesn't support the field "Target end", as it allows me to use the "Target start" during the "When: Field value changed" rule at the beginning. Target end and Target start are the same type of field. It's somewhat silly that the "Target end" doesn't appear in the dropdown during the “Edit issue” rule.
I will provide some screenshots to illustrate my point.
That said, I will check the link you provided. I hope I will be able to find a workaround or something. Thank you again so much for all your help!
- Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I am looking at this correctly, the "Target end" field is supported by the automation rules. Screenshot added.
- Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for those additional checks, @Shahriar
This could be a timing problem where the smart value expression is not evaluated fast enough for the Edit Issue fields action to use it. The way to check that is using a Created Variable action to pre-build the JSON for use in the action:
{
"fields": {
"customfield_13206": "{{issue.customfield_19810.toDate.plusBusinessDays(3).jiraDate}}"
}
}
the JSON is: {{varJson}}
{{varJson}}
This approach will also allow you to check what JSON is being used in the action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
I added what you mentioned. Could you please review my screenshots and confirm if this looks correct, and what I should do next?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on all of that, the field did not convert to a date or it was already a date.
Please change your log action for:
customfield_19810 with toDate: {{issue.customfield_19810.toDate}}
Into this:
customfield_19810: {{issue.customfield_19810}}
This will confirm what the rule "sees" for the field value before any attempts to change it.
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.
Hmmm...so either that is text (and will not convert to a date for some reason) or it is a date type.
These would confirm it:
If neither of those work, I am out of ideas to try for this one...
Other than the possibility of a corrupted rule. That may be checked by disabling this rule, and creating a very simple rule to try to access and edit the field for just one issue. If that works, the behind-the-scenes rule configuration was broken.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Those didn't work, but I got it to work by removing most of the things and just keeping this:
{{issue.customfield_19810.plusBusinessDays(3)}}
That worked :)
Thank you so much for all your help!
- Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn we confirmed it was a date after all!
It is unfortunate there is limited documentation from Atlassian on which date / time fields are text versus date types when they reach rules. As we found...experimentation is key!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Shahriar
Thanks for the question.
Try to find the customfield ID for the Target start field and use this expression.
{{issue.customfield_12345.plusDays(3)}}
Also,
.plusDays() → adds calendar days
.plusBusinessDays() → adds business days
Let me know, if this worked or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Gor Greyan ,
Thank you so much for your response. Unfortunately, that didn't work. I tried it using the custom field ID before, and I tried it after you sent it by copying and pasting the expression. It doesn't change the value for the "Target Discovery End Date" field. I am attaching some screenshots to show you what I have. Please try it on your end and see if it works for you. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Shahriar
I could see above that @Bill Sheboy provided the solution.
That's great, thanks!
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.