Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an automation rule to add days to a date field?

Shahriar
Contributor
November 12, 2025

Hi, 

I have the following date fields:

  • Target start
  • Target Discovery End Date

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

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2025

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

Shahriar
Contributor
November 13, 2025

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

Like Bill Sheboy likes this
Shahriar
Contributor
November 13, 2025

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, 

Example 1

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

Example 2

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2025

Please add some Log actions to the rule to confirm what is in the smart values for the fields before changing them.  For example:

  • action: Log, with this expression...
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:

  • ...
  • action: edit issue, to update the "Target Discovery End Date"
  • action: re-fetch issue data
  • action: edit issue, to update the "Target Define End Date" (based upon the earlier change)
  • ...

 

After doing that...please post an image of your current, complete rule and the audit log details showing the rule execution.  Thank you!

Shahriar
Contributor
November 13, 2025

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.

Screenshot 2025-11-13 at 2.33.48 PM.png
 

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2025

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}}"
}
}

 

https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html#AdvancedfieldeditingusingJSON-Datepickercustomfield

Shahriar
Contributor
November 13, 2025

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!


Screenshot 2025-11-14 at 12.32.57 AM.png

Screenshot 2025-11-14 at 12.38.30 AM.pngScreenshot 2025-11-14 at 12.38.06 AM.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2025

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.

  • action: Log, with this expression...
customfield_13205: {{issue.customfield_13205}}
  • action: Log, with this expression...
customfield_19810 with toDate: {{issue.customfield_19810.toDate}}
  • action: Log, with this expression...
customfield_19810 incremented: {{issue.customfield_19810.toDate.plusBusinessDays(3)}}
  • action: Log, with this expression...
customfield_19810 incremented and formatted: {{issue.customfield_19810.toDate.plusBusinessDays(3).jiraDate}}

 

 

Shahriar
Contributor
November 14, 2025

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

Shahriar
Contributor
November 14, 2025

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

Screenshot 2025-11-14 at 10.44.34 AM.pngScreenshot 2025-11-14 at 10.46.21 AM.pngScreenshot 2025-11-14 at 10.26.13 AM.pngScreenshot 2025-11-14 at 10.26.38 AM.pngScreenshot 2025-11-14 at 10.28.20 AM.pngScreenshot 2025-11-14 at 10.28.35 AM.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2025

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:

  • Identify an example issue with your fields, noting the key
  • With a browser tab, call the REST API endpoint to check the returned fields and smart values
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • Search on the page for your fields, such as with CNTRL-F (find)
  • If you see them, note the correct smart value / custom field ID.  If not, the field is not supported by automation rules.

 

Shahriar
Contributor
November 17, 2025

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

Screenshot 2025-11-17 at 9.26.36 AM.pngScreenshot 2025-11-17 at 9.26.11 AM.png

Shahriar
Contributor
November 17, 2025

@Bill Sheboy ,

If I am looking at this correctly, the "Target end" field is supported by the automation rules. Screenshot added.

- ShahriarScreenshot 2025-11-17 at 9.34.11 AM.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2025

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:

  • action: create variable
    • variable name: varJson
    • smart value
{
"fields": {
"customfield_13206": "{{issue.customfield_19810.toDate.plusBusinessDays(3).jiraDate}}"
}
}
  • action: log
the JSON is: {{varJson}}
  • action: edit issue, where the entire JSON expression is just the variable:
{{varJson}}

 

This approach will also allow you to check what JSON is being used in the action.

Shahriar
Contributor
November 17, 2025

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?Screenshot 2025-11-17 at 10.50.05 AM.pngScreenshot 2025-11-17 at 10.54.51 AM.pngScreenshot 2025-11-17 at 10.55.11 AM.pngScreenshot 2025-11-17 at 10.55.35 AM.pngScreenshot 2025-11-17 at 10.55.47 AM.pngScreenshot 2025-11-17 at 10.57.23 AM.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2025

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:

  • action: Log, with this expression...
customfield_19810 with toDate: {{issue.customfield_19810.toDate}}

 

Into this:

  • action: Log, with this expression...
customfield_19810: {{issue.customfield_19810}}

 

This will confirm what the rule "sees" for the field value before any attempts to change it.

Shahriar
Contributor
November 17, 2025
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2025

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 {{issue.customfield_19810.trim}} fails, it is not text, it is a date.  And so it should be possible to use it that way elsewhere.
  • If {{issue.customfield_19810.trim.toDate.jiraDate}} works, it is text, and had some extraneous characters which prevented the conversion before.

 

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.

 

Shahriar
Contributor
November 17, 2025

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

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2025

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!

Shahriar
Contributor
November 17, 2025

Agreed! You are absolutely right! Thank you so much for all your help. 

- Shahriar 

3 votes
Gor Greyan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2025

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.




Shahriar
Contributor
November 13, 2025

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.

Screenshot 2025-11-13 at 9.07.56 AM.pngScreenshot 2025-11-13 at 9.08.59 AM.png

 

Like Gor Greyan likes this
Gor Greyan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2025

Hi @Shahriar

I could see above that @Bill Sheboy provided the solution.

That's great, thanks!

Suggest an answer

Log in or Sign up to answer