Forums

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

Is it possible to use a smart value within the .minusBusinessDays() function?

Diogo Teles
Contributor
December 15, 2020

Hi!

I am trying to use automation to set the start date of issues based on the Due Date.

This is what I tried so far:

1) Define a variable to get Original estimate in days, based on 8h days:

Variable Name: estimateDays

Variable Smart Value {{#=}}{{triggerIssue.timeoriginalestimate}} /60/60/8 {{/}}

After testing by printing to a text field, the variable outputs the correct value of the Original Estimate in days.

 

2) define action to edit the Start date to:

{{triggerIssue.Due Date.plusBusinessDays({{estimateDays}})}}

 

I got the audit message 

Edit issue

Error rendering smart-values when executing this rule:Failed to get value for triggerIssue.Due Date.plusBusinessDays({{estimateDays: {{triggerIssue.Due Date.plusBusinessDays({{estimateDays}})}}

 

Replacing the variable by a specific number of days (e.g. 5) will work. But it seems anything other than an integer here will not work.

Is my syntax wrong or is this really a limitation of minusBusinessDays()? And is so, does anyone know of an alternative way to do this using automation? We do not use or plan to use ScriptRunner.

Thank you!

 

1 answer

1 accepted

2 votes
Answer accepted
wwalser
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2020

Hi @Diogo Teles, what you're trying to do is possible. There are just a few additional things to recognize about smart values before it'll work.

Here is the solution that you're looking for, I'll explain it below.

Screen Shot 2020-12-17 at 3.35.07 pm.png

Two things:

1. Once you're insight of the handlebar syntax `{{`, you don't need to use it again to reference variables.

2. The create variable action stores the variable as a string, so one needs to use the asNumber function to coerce it into a type appropriate for use inside plugBusinessDays.

Hope that helps. :)

Diogo Teles
Contributor
December 17, 2020

Thank you so much! I was so close, during one of my tries, I did use asnumber but to create another variable. Which, from what you explained here, was pointless as it converts it to string again. Then tried to use that variable for the plusdays(). I did call it without {{}} at one point but it just deleted the date. Now I see that was because it had a string in the input. 

 

I really appreciate the example and the explanation, thanks.

Like Joelle Güfel likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events