Hi there
I have a value in a custom field that represents a number but is obviously stored as a string. Using Automation For JIRA, I'd like to compare it to Remaining Estimate (in secs) but in the 'Compare Condition' activity there is no greater than or less than condition available.
I can't use a regex here as I don't know the value of the custom field at design time and I can't use a JQL condition as JQL doesn't support the custom field as numeric.
Are there any suggestions on how to check whether the remainingEstimate >= custom field etc.?
Cheers,
Paul
Hi Paul,
You can achieve this in the Compare Condition. In our docs on Maths, https://docs.automationforjira.com/working-with-issue-data/math-functions.html#reference, you'll see it mentions "boolean operators result always in a value of 1 or 0 (zero). Any non-zero value is treated as a true value. Boolean not is implemented by a function."
So, could you try doing:
{{#=}}{{issue.field1}} >= {{issue.field2}}{{/}}
Then choose equals and for the second value, put 1.
That should hopefully achieve what you're looking for.
Cheers,
Simeon [Automation for Jira]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Paul_Sorauer,
I think this requirement isn't possible to fulfill, because it you can't sensible compare a text value with an int if there is no concept of casting.
In automation there is as far as I can see in the documentation no way to cast a value to a number type.
Without this it is expected behaviour that this comarison aren't possible. I guess you need to create a new custom field which stores the information as a number and transfer your data to it. Then you should be able to compare it.
With kind regards
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mario
Thanks for your answer.
Actually, it's my bad - it is already a numeric field, it's just that JIRA's JQL doesn't support comparing it to remaining estimate so I am unable to use AFJ's JQL condition. Using Script Runner I can easily do the comparison via a Groovy script but I'm looking at migrating to AFJ.
I think the main issue I'm struggling with is that AFJ's Compare Condition doesn't include any numeric comparison operators, (only string comparison operators such as 'starts with').
Thanks for your help,
Paul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Paul_Sorauer,
Good to know. I was wondering too, how much functionality of scriptrunner could be migrated to AFJ.
But right now I personally are more concerned with migrating our workflow automation (JWT, JSU ...) to AFJ-Rules to decouple them from the workflow. It is such a nuisance if you make your workflows so hard to adapt to the real world workflow changes jsut because everywhere are hidden automations ;)
Best of luck with your task anyway!
With kind regards,
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.