Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

1 vote
Answer accepted
wwalser Atlassian Team Dec 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. :)

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.

Suggest an answer

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you