Forums

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

Workflow postfunction to trigger transition on Bug issue type from Story issue type

Sreedevi Raman Pisharody September 5, 2023

Hello Team,

I have been working on Jira workflow customization to trigger a transition from Open to In Progress for Bug issues which are linked to Story issues with Contains option.

I could get the below script working :-

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.workflow.TransitionOptions
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueService = ComponentAccessor.issueService
def actionId = 101 // Change this to the desired transition ID
def mainIssueKey = issue.key // Assuming this is within a post-function
def mainIssue = ComponentAccessor.issueManager.getIssueObject(mainIssueKey)
if (mainIssue)
{def linkedIssues = ComponentAccessor.issueLinkManager.getLinkCollection(mainIssue, currentUser).getAllIssues()
linkedIssues.each { linkedIssue -> def transitionValidationResult = issueService.validateTransition(currentUser, linkedIssue.id, actionId, new IssueInputParametersImpl()) if (transitionValidationResult.isValid())
{def transitionResult = issueService.transition(currentUser, transitionValidationResult)
if (!transitionResult.isValid())
{ log.warn"successfull"
}} else
{ log.warn"unsuccessfull"}}}
This code works for linked bug issues to be transitioned but how can i check and ensure the linked bug is through contains. Currently it works for all the linked bug issues, but i would like to know how to configure it for just contains option.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.9
TAGS
AUG Leaders

Atlassian Community Events