Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Script Runner Script to Display a Custom Screen in Jira?

lukec November 17, 2021

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

1 vote
Answer accepted
Joshua Sneed Contegix
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 17, 2021

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!

lukec November 17, 2021

Interesting .. Trying now ..

lukec November 17, 2021

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. 

Joshua Sneed Contegix
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 19, 2021

Hi Lukec,

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

lukec November 22, 2021

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. 

Joshua Sneed Contegix
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 23, 2021

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
AUG Leaders

Atlassian Community Events