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.setLevel(Level.DEBUG) 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 :
Please help me correct the behavior script
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 ]} formField.setFieldOptions(optionsMap) formField.setRequired(true) commfield.setRequired(false) } // 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 ]} formField.setFieldOptions(optionsMap) formField.setRequired(true) commfield.setRequired(false) } else { formField.setHidden(true) formField.setRequired(false) commfield.setRequired(true) }
- Added the condition as "Execute this on Done Action"
Results
if Resolution == Fixed
else if Resolution == Canceled
else
Thanks
Chander
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
Requirements:
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.