Forums

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

Automation: error with math expression

Sarah Sheffield November 18, 2021

Hi 

In an automation rule I use this expression to calculate the days an issue has been in progress (thank you to another community member who posted it):

{{#=}}ROUND({{issue.statuscategorychangedate.toDate.convertToTimeZone(reporter.timeZone).diff(now.convertToTimeZone(reporter.timeZone)).millis}} / (1000*60*60*24), 3){{/}}

In Jira Cloud it works perfectly.

But in Jira Server, I am getting this error every time I run it:

Error rendering smart-values when executing this rule:
Unknown unary operator '/' at position 7: ROUND(/(1000*60*60*24), 3)
How can the "/" division function be unknown?  I have tried replacing it with "divide" and that is also not recognised.
Any ideas from the hive mind?

1 answer

1 accepted

0 votes
Answer accepted
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.
November 18, 2021

Hi @Sarah Sheffield 

That would seem to indicate that the field statuscategorychangedate is null, and so there is a typo perhaps.  The field is statusCategoryChangedDate

Kind regards,
Bill

Sarah Sheffield November 18, 2021

HI @Bill Sheboy 

 

Thanks for the quick reply.  I've just tried that and am still getting the same error.

I'm going to do some more digging into the status category change date though - thank you for the direction to look!

 

Cheers,

Sarah

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.
November 18, 2021

Sounds good. 

Also I just checked the documentation field list for Server's JQL and didn't see that field.  Perhaps try an advanced search filter and enter that field name to confirm if it is present.

Like Sarah Sheffield likes this
Sarah Sheffield November 18, 2021

I checked the documentation and the advanced search - no such field in server - so I'll have to come up with a different way of measuring this.

Thanks for your help!

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.
November 18, 2021

Without that field, one other way to do this is to add a custom date/time field and set the value when *first* transitioning into an in-progress status.  You may then calculate the difference in the same way as I did with statusCategoryChangedDate.

The key is to only set the custom field when it is currently empty...otherwise it would update if you have multiple in-progress statuses.

Like Sarah Sheffield likes this
Sarah Sheffield November 18, 2021

Oh - nice idea.  I am going to have a go at that. (perhaps not today) I'll let you know how I get on.

 

Cheers!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer