How do i get current transition screen using script runner behavior?

Hi All,

I would like to check the log file that prints the current workflow Transition Screen.

What would be the import statements and method that returns the workflow transition screen.


Note: The behavior is written on a field present on the transition screen 

Also, the serverside script would be executed only on Done transition

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenManager
import com.atlassian.jira.issue.fields.screen.FieldScreen

import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger("Behaviour for Printing Transition Screen Name")
log.debug "Start of Log"
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def jpField = getFieldById("Resolution Type")
log.debug("Name of the Tranistion Screen " + getFieldScreen().name)
log.debug "End of Log"

Attached is the Screen Name found in Log after executing transition.



Expected Screen Name :

Screen-Done Transition.PNG


Transition Screen.PNG


Please help me correct the behavior script 

2 answers

This widget could not be displayed.

Please help me with some method reference, where i can hide one of the two fields present on transition screen


A transition screen will have 3 fields

1. Resolution  (jira default resolution field)

2. Reason (select list field) say values are A,B,C,D,E,F

3. Comment (JIra Default Comment field)


I would like to write a behavior when the value of Resolution changes 


if resolution == Fixed then hide Reason and Comment

if resolution == Canceled, then show A,B,C values under Reason

else (for any other value of resolution) show D,E,F for Reason field


Is this possible?

This widget could not be displayed.

Sorry guys, the code was all right, but i was testing on an unmapped issue type on the behaviour.


- Here is my code added on Resolution field 

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def resolutionField =  getFieldById(getFieldChanged())
def formField = getFieldByName("Reason for Resolution") 
def customField = customFieldManager.getCustomFieldObject(formField.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def selectedOption = resolutionField.getValue() as String
def commfield = getFieldByName("comment")
// Selection for Cancelled Resolution
if (selectedOption.contains("Canceled"))
  def optionsMap = options.findAll {
     it.value in ["Duplicate","Logged In Error","Wont Be Fixed"]}.collectEntries {
        (it.optionId.toString()) : it.value

// Selection for Rejected Transition

else if (selectedOption.contains("Rejected"))
  def optionsMap = options.findAll {
     it.value in ["As Designed","User Error","Env. Config","Not Reproducible"]}.collectEntries {
        (it.optionId.toString()) : it.value

- Added the condition as "Execute this on Done Action"


if Resolution == Fixed
else if Resolution == Canceled




Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

425 views 3 17
Read article

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