.groovy file on the workflow condition not working

Hi,

There is one strange behaviour I am observing in the workflow conditions.

I have a workflow button called 'Modify', I would like to show this button only in certain conditions.

I have written a groovy file which return either true or false. If the return value is true the button will be visible where as if it is false the button will be hidden from the user.

Now the problem here is, if I put this code directly in the simple scripted condition, everything works perfectly. Where as if I put this code in a file and refer that file path in a script condition this code is not working, the button is visible even if the groovy file returns false.

I checked that the groovy script is running in both the cases though.

Is it a bug or expected behaviour. Since the script is quite long, I would prefet it to be kept in a file and referenced rather than directly putting it on the screen.

Steps to Reproduce this:

1. Take one simple workflow, with a transition called Modify

2. Add a condition --> Script Condition --> Simple Scripted Condition-->return false

The Modify button will be hidden

3. put return false in a groovy file, refer it in the conditon

Add a condition --> Script Condition -->Give file path in Script File Path

The Modify button will be still visible when you run the code

JIRA Version - 6.0.6

Script Runner Version - 2.1.11

Kindly suggest.

1 answer

1 accepted

I think you're comparing "Simple scripted condition" with writing a custom condition (understably confusing).

For a file you should use:

passesCondition = false

Docs: https://jamieechlin.atlassian.net/wiki/display/GRV/Conditions

Simple scripted condition just aimed to make simple one-liners easier. Hopefully it's clearer in 3.0, where everything can be either inline or in a file.

Hi Jamie,

I updated the groovy runner plugin to the latest version and used "Custom Condition" to refer the file.

It started working as expected.

Thank you for quick support

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,426 views 0 8
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you