So if I use the function below and hardcode a number, it works. But if I pass in a variable, it does not work.
Does plusdays not accept variables? If it does, what am I doing wrong?
{{triggerissue.duedate.plusdays({{triggerissue.recurrent days}})}}
I couldn't accept MA's answer because it was a comment under an existing answer so I'm reposting it here:
I found a key piece of information today that has resolved the calculation of the plusDays and plusBusinessDays function whilst passing in a variable. Apparently there's an "old" syntax you can use. Rather than {{issues.field.plusBusinessDays(yourVariable|numeric field)}} you can use the following:
{{#issue.field}}func=plusBusinessDays({{yourVariable|numeric field}}){{/}}Notes:replace field in issue.field with the date field in Jira that you want to add days to.replace yourVariable|numeric field with either a smart value variable or a field storing a number
using this syntax worked for me!
source of information/inspiration was found here - https://codebarrel.atlassian.net/browse/AUT-1791
Hi,
PlusDays function expects a number value I suppose.
What is the output of {{triggerissue.recurrent days}} ? If that gets a number value, try
{{triggerissue.duedate.plusDays({{triggerissue.recurrent days}})}} or
{{triggerissue.duedate.plusDays({{issue.customfieldId}})}} where customfieldId is the field id of triggerissue.recurrent days
The outcome of triggerissue.recurrent days is a double. So that's definitely working.
I read online that that's just the way it is. IIt just does not accept variables.
Are they planning to add this, I also need this functionality. Maybe you found some workarounds? Thanks
I would like this updated too. I am struggling to see how you will use this automation if you need to use hard coded values in date.plus[unit] functionality.
I had to use the variable in the if clause instead... so if <somenumber> = "weekly" then add 7 days a date field, etc. But that may not work for everyone. They need to fix it.
You saved my day!
Glad this sorted it out for you!
Amazing it worked like a charm to increase due date by a variable. Wasted a lot of time for simple issues. JIRA smart value sucks.
{{#issue.dueDate}}func=plusBusinessDays({{varDay}}) {{/}}
Hey, I found a simpler solution that worked for me. Make sure the variable is a number before performing the operation:
{{triggerissue.duedate.plusdays({{variable.asNumber}})}}
Hello dear Community! Yup, my joy is the result of the contribution that @Leonardo Oliveira made, which solved a section of my automation process.
I simply wanted to add a resource that worked in my case.
The effective smartvalue ended up being:
{{issue.Start Date.plusdays(DiferenciaDias.asNumber)}} , where the variable "DiferenciaDias" was correctly invoked as it wasn´t enclosed in "{{}}".
Again, thanks for your contribution Leonardo.
Hey Mariano, I'm glad it was helpful. Have a great day!
It looks like you're new here. Sign in or register to get started.