Forums

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

Jira automation plusbusinessdays using existing field

Omer Neumeier August 17, 2023

I want to automatically set an end date for a new cloned issue to be today + <<value from numerical field>>

In this case I have a number field called Duration and I set the value to "5" for my test object. When I run the automation I ask it to update the End Date as follows:

{{now.plusBusinessDays({{issue.Duration}})}}

This I think returns Null b/c the end date is not updated thus. Also I added an update to the comments to show the value of {{issue.Duration}} and it shows 5.0

Thoughts?

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Champion
August 17, 2023

Hello @Omer Neumeier 

Welcome to the Atlassian community.

Are there any messages in the Audit Log for the rule execution that provide insight?

Have you tried using the Log action to print out the final value to the Audit Log for the rule, and seeing what the result is?

Have you tried this way, removing the curly braces around issue.Duration?

{{now.plusBusinessDays(issue.Duration)}}

Is the end date field a date picker or a date/time picker? If it is just a date picker, then you may need to use a formatting function on your value, because {{now} is a date/time value.

Example:

{{now.plusBsinessDays(issue.Duration).jiraDate}}

Omer Neumeier August 21, 2023

Thanks @Trudy Claspill 
from the audit log

Edit issue

Error rendering smart-values when executing this rule:
Failed to get value for now.plusBusinessDays({{issue.Duration: {{now.plusBusinessDays({{issue.Duration}})}}

Log action

Error rendering smart-values when executing this rule:
Failed to get value for now.plusBusinessDays({{issue.Duration: Now+Duration is: {{now.plusBusinessDays({{issue.Duration}})}}

Log action

Log
Duration alone is: 10.0
I'm not sure whether end date is a date/time or just date but I am able to successfully run {{now.plusBusinessDays({{10}})}} so I imagine just date
Omer Neumeier August 21, 2023

Removing the {{ }} as you suggested works. Can you help me understand why?

From this -> {{now.plusBusinessDays({{issue.Duration}})}}
To this -> {{now.plusBusinessDays(issue.Duration)}}
Trudy Claspill
Community Champion
August 21, 2023

Hello @Omer Neumeier 

I can't tell you the technical reason why it works, as I am not part of the Atlassian team.

My experience has been that when a function calls for a parameter within parentheses, such as plusDays(value), and you want to use a smart value for that parameter, then you need to not include the curly braces.

There are already curly braces surrounding the entire smart value - {{now.plus...()}}. It seems like when another smart value is inserted into such a statement and you include the curly braces around that interior smart value, then that is a syntax error.

Trudy Claspill
Community Champion
August 21, 2023

If your questions have been satisfactorily addressed please consider marking the Answer as Accepted to help other community members find posts with validated solutions.

Suggest an answer

Log in or Sign up to answer