1) Show the issue status transition on the Parent change ticket based on the following conditions:
Otherwise, hide the issue status transition on the Parent change ticket.
2) If the value of "CMR Type" on the parent change ticket is set to "Emergency" then no limitations apply in regard to the issue status transition.
I have already tried out by setting up some logic in the workflow -> Conditions as well as in ScriptRunner but it's not working as expected.
Hi VVC,
I think there is no reason to use ScriptRunner behaviors.
If I understood you correctly, you should try something like this:
Hope it will help you!
I have added the below code in the behaviors initializer and mapped for the parent change issue type, also tried mapping to both parent and child change but to no luck. Any suggestions on the workflow or Script Runner behaviors code?
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def parentIssue = issueManager.getIssueObject(underlyingIssue.getParentId())
// Check if all sub-tasks are either "Cancelled" or "Done"
def allSubTasksDoneOrCancelled = parentIssue.getSubTaskObjects().every { subTask ->
def status = subTask.getStatus().getName()
status == "Cancelled" || status == "Done"
}
// Show or hide parent issue status transitions based on the value of "CMR type"
if (allSubTasksDoneOrCancelled) {
def cmrTypeValue = cmrTypeField.getValue()
if (cmrTypeValue == "Normal" || cmrTypeValue == "Standard") {
// Show the transition
getFieldById("action_191").setHidden(false)
} else {
// Hide the transition
getFieldById("action_191").setHidden(true)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.