Use math expression in date smart value to set due date

systems-intern March 10, 2022

Hello,

i have to set a due date with an automation for jira automation on jira datacenter. The due date should be the last day of the current quarter and i thought i could do something like this:

{{now.withmonthOfYear({{now.format("Q").multiply(3)}}).endOfMonth}} or

{{now.withmonthOfYear({{#=}}{{now.format("Q")}} * 3{{/}}).endOfMonth}}

but its not working. Is there a way to achieve this?

 

the .multiply thing doesnt seem to do anything at all, but the expression

{{now.format("Q")}} * 3{{/}}

does give back the numer 3 i would need, but if i use that in the due date field i cant even save the automation.

2 answers

0 votes
systems-intern March 11, 2022

@Bill SheboyHello,

the datacenter version doesnt have the variable functionality. I was able to save the rule with the asNumber part, but it again didnt work. The due date fields just stays empty. I was able to do it with a scriptrunner script...but it feels like overkill :(

0 votes
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.
March 10, 2022

Hi @systems-intern 

You might need to convert the result of the format() operation to a number for the math to work, or store it in a created variable and then use it.  To do it the first way, please try:

{{now.withMonthOfYear(now.format("Q").asNumber.multiply(3)).endOfMonth.jiraDate}}

Kind regards,
Bill

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.
March 11, 2022

Hi @systems-intern 

Please try to keep your responses to one thread of conversation.  That will help others see if there are multiple approaches to solve the problem.  Thanks!

And thanks for noting you are using the Server/Datacenter version.  Please try to include that information when posting questions as the different Jira versions have different behaviors.

The smart value expression I provided will return the correct value.  To use that to set the Due Date field try removing the last part which specifies the data format:

{{now.withMonthOfYear(now.format("Q").asNumber.multiply(3)).endOfMonth}}

 

If that still does not help, please post images of your complete automation rule and of the audit log details showing an execution of the rule which does not work.  Those images may provide more context for what is happening.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events