Custom info on transition screen [Behaviours and Script Runner]

I am facing an unusual problem right now related to Behaviours(Script Runner) plugin. I need to display an info or so called warning at the top of the transition screen. I already tried to use Behaviours validator which looks like this:

FormField field = getFieldById("customfield_XXXXX");
field.setHelpText("My warning message !!!");

The problem is it displays an info below the form field which does not satisfy me. I had  an idea which corresponds to Script Runner's 'Custom Validator Script'. It can throw InvalidInputException. I remember that InvalidInputException can be instantiated with 'field name' and 'error message' so it's 'error message' is displayed below the field. BUT if you pass only 'error Message' it will be shown at the top of the screen.

My questions are: Is there a way to display some message at top (above all screen fields) of the screen and if so, how to do it in groovy ? Am i thinking right to use InvalidInputException ?



2 answers

This widget could not be displayed.

Use a workflow validator if you want to do this, don't use behaviours. If you use a validator then yes you throw an InvalidInputException.

The problem is if i use workflow validator the message will be shown after user clicks button to close (validate form) screen. And i need the message to be shown straightaway the transition screen apprears.

That's true. I would just put the message under the summary... currently behaviours doesn't have support for sticking the message at the top.

Thanks, Jamie. Now i'll try non proffesional way :) : put some javascript as help text (setHelpText()) with Behaviours.

This widget could not be displayed.

I did it with help of jquery:

image2014-11-26 10:32:26.png

And with this code used as Behaviours validator script:

FormField assignee = getFieldById("assignee");
String js = "<script>\n"+
    "AJS.\$(\"#assignee-container\").before(\"<div id=\\\"title-container\\\"><span>This transition is for authorized users only !</span></div>\");\n"+
    "AJS.\$(\"#title-container span\").css(\"color\",\"red\");\n"+
    "AJS.\$(\"#title-container\").css(\"border\",\"1px solid red\");\n"+

Too fast... Now Behaviours can not let me pass the transition and every time i try to close the screen it shows alert:
image2014-11-26 10:54:28.png

That's pretty cool, although horribly unmaintainable ;-) Can't help thinking you just need a condition though.

Any idea why Behaviours keeps showing this alert ?

This happens if you try to submit when it's in the process of sending a request. Try putting the behaviour not on the assignee, but on some field that's not likely to change. I think you can put it on the project.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

195 views 1 3
Join discussion

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