I am using Jira Automation on Jira DC 9.3.
What I am trying to do is to use the result of a math round function as a parameter of plusDays() function to set the duedate field.
(Below, I am using the value 13.2 for brevity. Actually, that value will come from another smart value, from the json of a previous REST call action.)
I tried this. This one works:
{{now.plusHours(round(13.2, 0))}}
But since the value from the REST call json is a string, I need to add an asNumber function like this:
{{now.plusHours(round({{asNumber}}13.2, 0))}}
When the rule runs, I get this error:
Error rendering smart-values when executing this rule:Failed to get value for now.plusHours(round({{asNumber: {{now.plusHours(round({{asNumber}}13.2, 0))}}
Then I presumed this was caused by the round function not being enclosed in math expression tags so I tried this:
{{now.plusHours({{#=}}round({{asNumber}}13.2, 0){{/}})}}
This time I can't even publish the rule. I get the following error message while trying to publish:
Error parsing template: Mismatched start/end tags: null != in template ....
The one below saves and executes successfully but of course, it processes the now.PlusDays() function as text and doesn't run it. It just prints it.
now.plusHours({{#=}}round({{asNumber}}13.2, 0){{/}})
I hope someone can enlighten me about this.
Thank you
EmreT
Hi Emre,
You need to setup a variable and then use the value of the variable. See this other post that will guide you through that.
Hello @John Funk ,
We did this on the cloud platform just as you said, with a variable. But there is no Create Variable action on Jira DC.
Is there a workaround?
EmreT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh - not sure then as I don't have a DC version. @Bill Sheboy - any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Emre Toptancı _OBSS_ and @John Funk
I noticed you have some extra curly brackets in the expressions...once inside of the brackets the other ones are not needed. For example:
{{now.plusHours(someVariable.asNumber)}}
Please note that I assumed use of a variable, and so converted from text to number type.
Next, round() has a few different syntaxes, such as {{issue.someField.round}} or {{#=}}round({{issue.someField,2){{/}}
If neither of those things help, please consider posting an image of your rule, including the details where the round() is occurring. Those may provide some context for the symptom you are observing. Thanks!
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Bill Sheboy ,
Below is the complete smart value that we are trying to use with Edit Issue action to update the duedate field.
{{now.plusDays({{#=}}round({{asNumber}}{{webhookResponse.body.table.body.rows.valueColumns.value.get(0)}}, 0){{/}})}}
As you can see, we are trying to round some value from the json result of an earlier Send Web Request action and add it to now to create a new duedate value.
It is worth emphasizing once again that we are on Jira DC 9.3 so there is no Create Variable action to use.
Thanks.
EmreT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information. Perhaps trying using chained functions instead:
{{now.plusDays(webhookResponse.body.table.body.rows.valueColumns.value.get(0).asNumber.round)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope, doesn't work.
This one returns a value:
{{webhookResponse.body.table.body.rows.valueColumns.value.get(0)}}
But when you chain an "asNumber", it returns empty:
{{webhookResponse.body.table.body.rows.valueColumns.value.get(0).asNumber}}
You know what? I tried the same thing with original estimate field. The smart value below works for original estimate:
{{#=}}round({{asNumber}}{{webhookResponse.body.table.body.rows.valueColumns.value.get(0)}}, 0){{/}}d
It is clear that we can do asNumber and round without a problem. But when I try to send this value to plusDays function as a parameter (as shown below), it starts complaining about mismatched start/end tags and doesn't publish the rule.
{{now.plusDays({{#=}}round({{asNumber}}{{webhookResponse.body.table.body.rows.valueColumns.value.get(0)}}, 0){{/}})}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That makes sense due to the embedded bracketing. I suspect the reason the chained value does not work is typing related. Perhaps consider sending that one to the support team and ask them why it does not work for the Server/Data Center version of automation rules.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.