It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to look at issue type in Condition section of Script Post-Function function for a transition

Trying to define a Condition in a Post-Function where I perform an Action based on a Condition.

The Condition is to look at the issue type and see if it equals a certain string value. Example below: == "New Feature"


Is the syntax above correct? Does store the issue type?

In general, where does one go to fine out the class name and class state (variables) so one can write accurate Conditions in a Post-Function?


1 answer

1 accepted

11 votes
Answer accepted


Yes it is correct (because getIssueType returns a GenericValue which implements Map, and you can get values by calling the key as a property in groovy), although it might be better to say: == "New Feature"

> In general, where does one go to fine out the class name and class state (variables) so one can write accurate Conditions in a Post-Function

So there are two things you need to do this, 1) to know what variables you can use (ie are in the script binding), and 2) what types they are so you can work out what methods to call on them.

You can get 1) , and 2) actually, from here: , or looking at the source code.

So for instance you know now that *issue* is a MutableIssue, so you look at the javadoc at

Now you find you can call getIssueTypeObject() on it, and in groovy thing.issueTypeObject is just shorthand for the same.

And finally if you go to Admin -> Script Runner -> Built-in Scripts -> Condition Tester you can test the condition on various different issues, which is much easier than publishing a workflow. In your case above you would have got a MissingMethodException (or similar).

Really finally, if you set up the source in a good ide like intellij idea, you never need bother with the javadoc:

HTH, jamie

Thank you for your help. This is very useful. I was wondering how to setup Intellij IDEA on my (local) Windows PC to debug (step through) the source code of a JIRA instance running on another (Linux) server. Any ideas?

Well - did you follow the instructions in the link above?

I read thru the instructions in the link and wondered 'how does this allow me to debug remotely?'. Maybe I am missing something but does it not say to download and install the source code locally (ok, no problem)? I have not used Intellij IDEA to do remote debugging. If it's just a matter of following the instructions on that link, I'll give it a shot. The step 'Assure you can run JIRA properly before continuing' also is confusing to me. How do I do that on my PC with 4Gb of memory (is that enough memory)?

I appreciate all your feedback btw -- very kind of you to assist.


4gb is plenty. You don't need the source code to use those instructions, it's mainly to give people intellisense. You can attach the javadoc as well then you don't need to browse it on the web. Having the source code is helpful if you want to step in to the jira classes but it's not necessary for writing a plugin.

Debugging remotely is the same as for any java app... just specify the name of the remote host.

Hi, for developing in JIRA it is better edit startup_bundled_jre.bat to run JIRA in debug mode.

Just add parameters

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9095

to set JAVA_OPTS=-server %JAVA_OPTS%

and connect to remote host on port 9095

I am not trying to develop a plugin, btw, but thanks for that input (I may do so in the future and its good to know).

I have installed Groovy and GroovyRunner and a post function (to Fast-track transition an issue) does not appear to be working. So I wanted to step through the code to see 'why' this problem exists.

It's the same advice as above for stepping through groovy.

Is this the same case for a custom issue type, e.g called specials i would use "Specials" or do i need to refer to it by the ID number?

Hi Jamie, 

Should this syntax also work for condition statements on post functions?

I've used the exact syntax above to apply a condition to a Transition Parent Issue post-function, but it doesn't fire. The post function works when I set no condition; it also works if I set a basic condition that will always return true ( like 1 == 1 ).

Do I need to be doing something like calling a library or something (I figured that one line would be enough in the context of "this" issue). 


N.B. this is on JIRA 6.4.12 and ScriptRunner

Even though the question is over five years old wink yes it should still work. 

If not try adding an assertion in the previewer:

What is your actual condition?

Thanks for getting back to me Jamie,

I know it's old, but it looks like exactly what I need, and I took a punt that you'd still reply pretty quickly! laugh

I'll take a look at it with a power assertion. In the meantime, the thing I'm trying to do is this:

I'm applying a transition parent issue post function to a subtask's workflow. I only want the parent to transition when the subtask in question has a particular issue type.

So, in the post function (on the subtask's workflow) I've entered a condition line to test that the subtask's issuetype is a "Design Task" so: == "Design Task"

Looks fine. If it always returns false add the assert (just temporarily while previewing). You might have a trailing space or something or case issue or something.

Ah, I think I've figured something out! It looks to me like the post function for Transition Parent issue isn't one supplied by Scriptrunner. I disabled Scriptrunner in our non-production platform and the post function is still available to me!

I'd just assumed that it was because it was asking for a Groovy expression in the condition field.

The code you gave me works perfectly in an actual Scriptrunner post function (tested it in the Custom email one) but the one I'm having trouble with returns a NoSuchElementException in the logs.

I'm guessing I'll probably need to add in some import statement or other to get the right component accessor. Clearly this post function isn't as well written as your ones! laugh

Thanks for your time!

OK, I've managed to sort it now, in case you're interested.

The post function is supplied by JIRA Misc Workflow Extensions, and it looks like it's set up to access a limited set of functions: issue, issueObject, or parentIssue.

After digging around I ended up with:

issue.get("issuetype").name == "Design Task"


Thanks again for your input Jamie smile

Darren you made my day smile

Glad to be of service laugh

Any chance you have a solution for how to get actual issue status?
I have tried a lot of options and non was working for me:
issue.get("status").name == "Open" 

issue.getSimpleStatus().getName() == "Open"

issue.get("status").getName() == "Open"

underlyingIssue.getStatus().getName() == "Open"

issue.getStatus().getName() == "Open"

issue.getStatusObject().getName() == "Open"

Hi Adam,

I just gave this a try (after finding the answer on another forum smile) and it works for me:


I also tested it for the use case that I personally would apply it to: checking the status of the parent issue, which would be:


That works for me too. Incidentally, if you're having trouble getting the issue status for issue.get("status") in a transition post-function, maybe it's about the status of the issue at the point the post-function runs?

issue.get("status").getName() worked for me when I'd evaluated it against the status that the issue was moving from, rather than the one in moves to

Does that help at all?

Hi Darren,

thank you for your input. I was following the same article you mentioned but without success. My use case is:

  • we use kanban boards and according workflows much (it means ALL transitions to statuses)
  • I want tu get rid of transition of status to itself (so actual and destination status is the same
  • i am using this validation as condition (not in post function) -> "Scripted (Groovy) Condition (JMWE add-on)"
  • unfortunatelly it allways returns false, so the particular transition is never shown

I have been googling a lot and removing transition to itself seems to be unsolved issue, i thought it could be solved with this condition but it does not work as I assumed.

Ah, I see; yeah, that wouldn't make much sense on a post function! smile

I've used "All" Transitions from time to time and I came up with the same problem. Personally I solved it by using the "Value Field" condition offered by Suite Utilities for Jira. If you've got the plugin, how the condition works is pretty much self explanatory: you just set "Status" as the field you're checking.

If you don't have Suite Utilities for Jira, definitely check it out; there's lots of useful things in it.

Hope that helps.

Finally, this forum works smile

We have Suite plugin so I have tried proposed solution and it works fine. It takes more time than I would like to spent on this task (considering JIRA prices - creating field, seting it on transitions and than manually validate each transition) but finally its done.

Thanks again


works for me with

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Keep your team in the loop with Team @mentions in Jira Software!

Hi everyone! My name is Jenny, a Product Manager at Atlassian. After launching Team @mentions in Confluence, we heard a lot of positive feedback from customers that they love how easy it is to @men...

501 views 5 17
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