Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Help with script runner - required field

Bianca Borges
September 28, 2017

Hi, I need a little help to build a script that does the following:

For a specific issue type, a custom field is required when this issue is closed.

Some background:

  • The project has several issue types
  • When the issue type "Service Desk" is being Closed (transition) the script must validate if custom field is not empty (it's a Select List (single choice) type).

I'm new at JIRA and I'm not a developer, so any help is highly appreciated :)

I looked at this behaviour example and I think this will do the trick, however set to issue type instead of Resolution....any clue where I should start?

import com.atlassian.jira.issue.resolution.Resolution 

def resolutionField = getFieldById("resolution")

def fixVersionsField = getFieldById("fixVersions")

def resolution = resolutionField.getValue() as Resolution

if (resolution.name == "Fixed") {

fixVersionsField.setRequired(true)

fixVersionsField.setHidden(false)

}

else {

fixVersionsField.setRequired(false)

fixVersionsField.setHidden(true)

} 

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 2, 2023

Hi @Taylor Chase

There is no simple way to get the information you are requesting.

If you want to find out what code it is, you will first need to go to the classes folder located at

<JIRA_HOME>/scriptrunner/classes/ for example /var/atlassian/application-data/jira/scriptrunner/classes/ and try to find the db56710530ed3a3618d2b2858bf365b8.class file in there. (Please note, this class file name can always change)

Once you have located the class, you will need to de-compile using for example IntelliJ.

After the class file has been decompiled, you will need to compare it against your Groovy code to see which code is actually causing the problem.

I hope this helps to solve your question. :-)

Thank you and Kind regards,
Ram

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 8, 2023

Hi @Taylor Chase

Has your question been answered?

If yes, please accept the answer.

Thank you and Kind regards,

Ram

Taylor Chase
July 10, 2023

Thank you for your help @Ram Kumar Aravindakshan _Adaptavist_ It turns out that my log collector was splitting the log lines improperly.  I looked at the physical logs and they provided a URL to edit the failing item - and I was able to resolve the issue.

TAGS
AUG Leaders

Atlassian Community Events