2
1
0

Hi team,

I have an integration between Jira and Zendesk. I would like to cut the comment when it has more than 65535 characters. I have created a script and its works fine but the comment author appears 2 times. How i can fix this?
You can find attached the script and the comment.


//Comments
issue.comments = commentHelper.mergeComments(
issue,
replica,
{ comment ->

if (comment.internal) {
comment.body = "Internal " + "comment from Zendesk: \n" + "[" + comment.author.displayName +
"| mailto:" + comment.author.email + "]" +
" commented: \n" + comment.body
}
else {
comment.body = "Public "+"comment from Zendesk: \n" +
"[" + comment.author.displayName +
"| mailto:" + comment.author.email + "]" +
" commented: \n" +comment.body
}

def maxCommentLength = 65535
def template = "[

{0}

|mailto:

{1}

]" +
" commented: \n" +
"'

{quote'}\n" +
"{2};\n" +
"'{quote'}

\n"
def renderedWithoutBody = java.text.MessageFormat.format(
template,
comment.author.displayName,
comment.author.email,
""
)
def allowedLength = maxCommentLength

renderedWithoutBody.length()

comment.body = java.text.MessageFormat.format(
template,
comment.author.displayName,
comment.author.email,
comment.body.take(allowedLength)
)
comment;
}
)



Thank you.

  1. Francis Martens (Exalate)

    The code is hard to read - can you reformat it?

  2. Christos Katsivas

    Hi Francis, 


    Yes I confirm. I found the problem and its works fine. 


    Thank you.

CommentAdd your comment...

1 answer

  1.  
    2
    1
    0

    Looking at the image, the comment was ping-ponged.

    Comment C on source issue 'A' was synced to issue'B', getting reformatted to C'
    Then that comment (C') was synced back to issue A, being reformatted to C''

    Can you confirm?

      CommentAdd your comment...