Forums

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

How to Compare remainingEstimate to a custom field using Automation for JIRA?

Paul_Sorauer February 14, 2019

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

2 answers

1 accepted

1 vote
Answer accepted
Deleted user February 15, 2019

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] 

Paul_Sorauer February 17, 2019

Thanks for your answer, @[deleted] 

0 votes
Mario Carabelli
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.
February 15, 2019

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

Paul_Sorauer February 15, 2019

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

Mario Carabelli
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.
February 15, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events