1
0
-1

I am trying to add an internal note to a Zendesk ticket on the first exalate sync that will add the username of the GitHub reporter and also the replica.key. Here is what I'm trying:


//add note about github username
if (firstSync) {
     def github_username = []
     github_username = nodeHelper.getUser(replica.reporter?.username)
        issue.comments = 
            comment.internal = true
            comment.body = github_username + replica.key 
}


I am getting the following error:

Error impact: Relation

Error type: Incoming script error

For input string: "{this is the github username}"

  1. Ariel Aguilar

    Hi Sydney,

    Maybe you can try

    Incoming Zendesk:

    if (firstSync) {
    issue.comments = commentHelper.mergeComments(issue, replica,                     
                { it.internal = true
                comment ->
                comment.body = "Reported by user: " + 
     replica.reporter.username + " and reference key: " + replica.key
    			comment 
                        }
    )
    }

    Kind regards,

    Ariel

  2. Sydney Hollingsworth

    Hi Ariel,


    Thanks, copy and pasting this wouldn't let me save so I edited to:


    if (firstSync) {
    issue.comments = commentHelper.mergeComments(issue, replica, { 
        comment ->
            comment.internal = true
            comment.body = "Reported by user: " + 
            replica.reporter.username + " and reference key: " + replica.key
            comment 
        }
    )
    }



    Update: This does not work. Can you help further? 

  3. Ariel Aguilar

    Hi Sydney,

    Can you please try:

    if (firstSync) {
    issue.comments = commentHelper.addComment("Reported by user: " + 
            replica.reporter.username + " and reference key: " + replica.key, false, issue.comments) 
    } else {
      issue.comments     = commentHelper.mergeComments(issue, replica)
    }

    Kind regards,

    Ariel

  4. Sydney Hollingsworth

    Update: 


    if (firstSync) {
    issue.comments = commentHelper.addComment("Reported by user: " + replica.reporter.username + "\n GitHub URL: " + issueUrl, issue.comments)
    }

    this seems to do the trick!

  5. Ariel Aguilar

    Ok great, I added the false statement since you may not want to add this comment to the replica, so if a new comment is added in Zendesk the just added comment won't show on GitHub side, but only the new ones. Also, the else clause in case you want to make a second sync.

    Kind regards,

    Ariel

CommentAdd your comment...