Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Script Runner Script to Display a Custom Screen in Jira?

Is there a way that Script Runner can display a custom screen once a custom field is selected to a certain value?

ie: Custom Field 'Review' is set to Yes, from No. 

Script Runner Behaviour will identify the change, and display this Screen, which is different from the Create , Edit , and View Screens. 

Anyone know how to do this?

I have a script, below, which requires a comment. But the Edit screen that it is using contains a bunch of fields, and I want to limit the 'noise' if possible. 

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.issue.comments.CommentManager

@BaseScript FieldBehaviours fieldBehaviours

def regressionIssueField = getFieldById(getFieldChanged())
def regressedVersionField = getFieldById("comment")

String regressionIssueValue = regressionIssueField.getValue()

if (regressionIssueValue == "Yes") {
regressedVersionField.setRequired(true)
} else {
regressedVersionField.setRequired(false)
}

1 answer

1 accepted

Hi lukec,

I'm going to  say, yes it can but you shouldn't. It makes more sense to use screen tabs and Scriptrunner Behaviours to organize and hide the fields. You should also consider moving some of them to transitions screens, possibly transition screens on a "loop" transition (transition from a status to itself). Cheers!

Interesting .. Trying now ..

I couldn't get it. Made a "loop" transition. But couldn't get the issue to loop based on the Custom Field being changed. 

I could do that with Automation for Jira.. go from In Progress to In Progress.. but requiring the comment during that transition (via workflow) prevents the Automation from completing. It errors out. 

Hi Lukec,

Can you include a comment in the automation or remove the requirement? Cheers!

Thanks Joshua .. the comment will be different every time depending on the situation and the user will need to specify each time. 

The requirement cannot be removed. 

Hi Lukec,

Then you cannot use the method you are seeking to use. It's also a bad idea to extend Jira sufficiently that you can produce pop-up screens at will, your future self/admins will either love/hate your current self based on this decision.

I would recommend using methods a bit closer to what comes out of the box and then use some form of automation to do math/logic/etc, but do not use scripting to make your instance do something that approximately 100% of other instances do not do. That is asking for problems.

Cheers!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

676 views 5 12
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