condition to if then true else false

Deleted user November 9, 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 :)

12 answers

3 votes
Deleted user November 9, 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?

2 votes
Oliver Siebenmarck _Polymetis Apps_
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 9, 2019

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

1 vote
Deleted user November 20, 2019

Dear Blazej Borucki,

 

Thanks. I managed with the Automation for Jira application.

1 vote
Oliver Siebenmarck _Polymetis Apps_
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 9, 2019

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.

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 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. 

0 votes
Blazej Borucki November 20, 2019

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.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2019

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

0 votes
Deleted user November 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.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2019

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

0 votes
Deleted user November 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.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2019

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

0 votes
Deleted user November 9, 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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events