Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,031
Community Members
 
Community Events
165
Community Groups

condition to if then true else false

Deleted user Nov 09, 2019

Need a condition for Jira's workflow: something like

// If input equal or less then true
jira.issue.worklog.value <= jira.issue.originalestimate.value
return true;

Else

// If input more than then true false
jira.issue.worklog.value > jira.issue.originalestimate.value
return false;
});

 

Any help will be much appreciated :)

3 comments

John M Funk Community Leader Nov 09, 2019

Hi Kate - Welcome to the Atlassian Community!

I don't believe that is going to be possible with out of the box Jira. However, if you use an add-on like JMWE or ScriptRunner you should be able to do that. 

Like Deleted user likes this
Deleted user Nov 09, 2019

Thanks for the reply John. I realized Jira's out of the box settings does not allow something this specific.

The coding apps are a bit difficult. I would need help into writing the correct code for this.

John M Funk Community Leader Nov 09, 2019

JMWE offers great support with their syntax, as well as others here. Should be something straight forward. 

Deleted user Nov 11, 2019

Dear John, just wanted to let you know that it is also not possible with the JMWE app after their developers told me they do not support this for Jira Cloud users.

John M Funk Community Leader Nov 11, 2019

So sorry about that - would have thought they would be able to compare two fields. Is there something more involved than that?

Deleted user Nov 11, 2019

As simple as it sounds in theory they said Jira Cloud is just too limited and that there are no workaround apps for it as there is also a Cloud bug when it comes to validating the timeSpent with originalEstimate.

I am now looking into creating a trigger to transition an issue once a user logged more time than the estimate field with the Automation app.

John M Funk Community Leader Nov 11, 2019

Sounds reasonable. I guess you could dump the value into a couple of custom fields and then compare them also. 

Hi Kate, 

it is definitely possible to have conditions in Jira's workflow. There are quite a few conditions (and validators) that come out-of-the-box and even more that come from Marketplace Apps. 

From you code examples I gather that you want to hide a transition if more work has been logged than was originally estimated; you will need a Marketplace App for that. There are few options available, but in my biased opinion Cloud Workflows is a great option, as it supports Jira Expressions as workflow conditions.

Here's how you would solve your scenario with Cloud Workflows:

  1. Add a "[CW] Custom Jira Expression" condition to your workflow
  2. Enter the following Jira Expression:
issue.timeSpent <= issue.originalEstimate

Publish your changes and you're done!

Full disclosure: I work for Jodocus, the Vendor who created Cloud Workflows. Let me know if you need any help getting started, I'll be happy to help!

Cheers,

 Oliver

Like # people like this
Deleted user Nov 09, 2019

Hi Oliver,

Thank you for your response! So far the Cloud Workflow app is the most user friendly as ScriptRunner and the others are a bit more complicated.

I have tried your suggestion and it works perfectly!

Blocking the transition to which status I choose it to.

However, instead of blocking the transition, I need something to block the actual action of a user logging to not be allowed to log more than the original estimated field. Is this maybe possible?

Like # people like this

Hi Kate,

Glad to hear our app works for you! 

However, instead of blocking the transition, I need something to block the actual action of a user logging to not be allowed to log more than the original estimated field.

I understand that it would be even better to catch invalid input (ex. overbooking) at the moment the user enters data (ideally at the UI level), but I'm afraid that is much harder to achieve with Jira. Specifically with Jira Cloud I am not aware of any way to perform this kind of input validation – although it would certainly be a useful feature.

Like Jan Szczepanski likes this

I would also suggest the Automation app, pretty easy to use. 

 

Concerning validation of time logged it also can be done with automation, little bit complicated, but they got pretty good documentation. You should start with updated field trigger and advanced condition.

Deleted user Nov 20, 2019

Dear Blazej Borucki,

 

Thanks. I managed with the Automation for Jira application.

Like Blazej Borucki likes this

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,514 views 37 44
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you