We are trying to get a Feature to automatically transition to 'In Progress', when one or all of the linked issues are also transitioned.
Hi Karl,
Assuming that the Feature should transition into In Progress status when the linked issue transitions from [To Do - In Progress], you may set up a Custom script post-function at this transition step.
There's a sample script in the Adaptavist Library that you may adapt to your use case: Transition an Issue using Issue Input Parameters
I modified it to fit your requirements, maybe not exactly but you may try this out. Also, I'm unsure if your issue can have multiple Features linked to/from it. However, this script takes that into consideration.
You can test this script in the Script Console & change it up as needed:
import com.atlassian.jira.component.ComponentAccessordef issueLinkManager = ComponentAccessor.issueLinkManagerdef workflowManager = ComponentAccessor.workflowManagerdef issueService = ComponentAccessor.issueServicedef user = ComponentAccessor.jiraAuthenticationContext.loggedInUser// test issue - remove the following line when implementing post-function script//def issue = ComponentAccessor.issueManager.getIssueObject('TEST-1')// the name of action used to transition Feature(s)final actionName = 'In Progress'// the corresponding workflow iddef actionId = workflowManager.getWorkflow(issue).allActions.findByName(actionName)?.idlog.warn "actionId: " + actionId// the name of the issue link type (taking into account the link direction - inward/outward)final issueLinkName = 'Relates'// if it's a Feature that's transitioning, don't run this scriptif (issue.issueType.name == 'Feature') { return}// find the Feature(s) linked to/from this issuedef featureInward = issueLinkManager.getInwardLinks(issue.id).findAll { it.issueLinkType.name == issueLinkName }?.sourceObjectdef featureOutward = issueLinkManager.getOutwardLinks(issue.id).findAll { it.issueLinkType.name == issueLinkName }?.destinationObjectdef features = featureInward + featureOutwardlog.warn "featureInward: " + featureInwardlog.warn "featureOutward: " + featureOutwardlog.warn "features: " + featuresfeatures.each { feature -> def issueInputParameters = issueService.newIssueInputParameters() def transitionValidationResult = issueService.validateTransition(user, feature?.id, actionId, issueInputParameters) assert transitionValidationResult.isValid(): transitionValidationResult.errorCollection def transitionResult = issueService.transition(user, transitionValidationResult) assert transitionResult.isValid(): transitionResult.errorCollection}
I hope that this helps!
If this response has answered your question, please do mark it as Accepted to make it easier for other users to discover potential solutions to their questions.
It looks like you're new here. Sign in or register to get started.