It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Duplicated comment added during transition

Good morning,

I'm running the below script but I'm not understanding why the target issue is updated with duplicated comment

import [...]

log = Category.getInstance("com.onresolve.jira.groovy.CreateDependentIssue")
log.debug "Debug statements " +

def BEprojectName = issue.getProjectObject().name
def SDProjectName = BEprojectName.substring(8,BEprojectName.length())
log.debug "BEProject: " + BEprojectName
log.debug "SDProject: " + SDProjectName

// Variables definition
ComponentManager             componentManager =         ComponentManager.getInstance()
IssueManager                 issueManager =             componentManager.getIssueManager()
ProjectManager                 projectManager =         componentManager.getProjectManager()
IssueFactory                 issueFactory =             componentManager.getIssueFactory()
JiraAuthenticationContext     authContext =             componentManager.getJiraAuthenticationContext()
CustomFieldManager             customFieldManager =     componentManager.getCustomFieldManager()
IssueIndexManager            indexManager =             componentManager.getIndexManager()
JiraWorkflow                 workflow =                 componentManager.getWorkflowManager().getWorkflow(issue)
IssueLinkManager             issueLinkManager =         componentManager.getIssueLinkManager()
IssueService                 issueService =             componentManager.getIssueService()
UserManager                 userManager =             (UserManager) ComponentAccessor.getUserManager()
IssueChangeHolder             changeHolder =             new DefaultIssueChangeHolder()

def wasIndexing = ImportUtils.indexIssues
ImportUtils.indexIssues = true

boolean existingLinkedCode = false

for (IssueLink issueLink in issueLinkManager.getInwardLinks({
    if( == "Trigger"){
        existingLinkedCode = true
        SDIssue = issueLink.sourceObject  
        String SDIssueKey = SDIssue.key
        log.debug "Inward linked issue: " + SDIssue.key
log.debug ("Search result: " + existingLinkedCode)

// Transition on original issue
if(existingLinkedCode == true){

    // Workflow Transition: extract details from transition properties (ex. user comment, transitionID, assignee...)
    def wfd = workflow.getDescriptor()
    def transitionComment = transientVars["comment"]
    def actionId = transientVars["actionId"]
    log.debug "comment: " + transitionComment 
    log.debug transientVars

    log.debug("Update original issue's status")
    def com.atlassian.crowd.embedded.api.User currentUser = ComponentManager.instance.jiraAuthenticationContext.getLoggedInUser()
    // Define parameters needed during issue workflow transition
    IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
    IssueService.TransitionValidationResult transitionValidationResult = issueService.validateTransition(currentUser, SDIssue.getId(), actionId, issueInputParameters)
    if (transitionValidationResult.isValid())
        log.debug "Transition Validation VALID"
        def transitionResult = issueService.transition(currentUser, transitionValidationResult)
        if (!transitionResult.isValid())
            log.debug "Transition result INVALID"
            log.debug "Transition result VALID"            
        log.debug "Transition Validation INVALID"
    log.debug("No existing links")

In my log file:

Debug statements 17478
BEProject: Backend ZS Support
SDProject: ZS Support
Inward linked issue: ZS-17
Search Result: true
comment: Commento
update original issue's status
Transition Validation VALID
Transition result VALID

When I open the new linked issue I see comment "Commento" twice.


Why this?


Thank in advance for your help


2 answers

1 accepted

And regarding why you see the log statements twice, are you running this as a listener? It will run for the source issue and the issue you update, sunject to which events you are listening for, same applies to workflow functions if the target issue has the same workflow. 

There is a bug in jira, it's related to skipScreenCheck. If you remove that, and you have a screen for that transition, you will only get the comment once.

Basically skipScreenCheck doesn't seem to work properly:

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 03, 2019 in Marketplace Apps

How to estimate projects more accurately?

Gaining insight into your team’s effectiveness and choosing the right estimation technique.   Estimating projects is hard. It is because people have the tendency to underestimate the time thin...

286 views 2 8
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