xl8bot
November 4, 2024, 7:54am
1
Originally asked by Bogdan Gorka on 21 July 2022 (original question)
I want to merge two properties for comments in Jira Service Management.
I need them to be at the same time:
1) public
2) formatted
I can achieve these objectives separately but not together. I could not find such a use case in the Community. Can anyone merge the snippets for me?
//Synchronize comments as public
issue.comments = commentHelper.mergeComments(issue, replica, {it.internal = false})
//Synchronize comments and format it diplaying an author name
issue.comments = commentHelper.mergeComments(issue, replica,
{
comment ->
comment.body =
comment.author.displayName +
" commented: \n" +
"{quote}\n" +
comment.body + ";\n" +
"{quote}\n"
})
xl8bot
November 4, 2024, 7:54am
2
Answer by Bogdan Gorka on 22 July 2022
This is the solution to this use case - tested and working.
issue.comments = commentHelper.mergeComments(issue, replica,
{
//Sync the comment and format the display of an author name
comment ->
comment.body =
comment.author.displayName +
" commented: \n" +
"{quote}\n" +
comment.body + ";\n" +
"{quote}\n"
//Make the comment public on Service Desk
comment.internal = false
comment
})
As a result, you get a nicely formatted public comment, which is visible on the portal.
This overcomes the limitation of the Jira Service Management, because you can allow a direct conversation between your Dev team with the JSM Customer.
xl8bot
November 4, 2024, 7:54am
3
Answer by Sim Hua Soon on 22 July 2022
Hi Bogdan,
I premise you are using Jira on-prem since Jira Cloud does not support mergeComments with custom formatting
Can you try
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.body =
comment.author.displayName +
" commented: \n" +
"{quote}\n" +
comment.body + ";\n" +
"{quote}\n"
//https://community.atlassian.com/t5/Jira-Service-Management/Create-Internal-Comment-using-REST-API-for-Jira-Service-Desk/qaq-p/857385
comment.public = false
})
or
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.body =
comment.author.displayName +
" commented: \n" +
"{quote}\n" +
comment.body + ";\n" +
"{quote}\n"
}) {
it.internal = false
}
Reference: https://docs.idalko.com/exalate/pages/viewpage.action?pageId=6226071
Comments:
Bogdan Gorka commented on 22 July 2022
Hi Sim Hua Soon
You were close but both solutions caused the sync to have an error. See the solution below that my good colleague developed.
Bogdan Gorka commented on 22 July 2022
And thank you Sim Hua Soon for the answer because it helped me to get closer to the solution
xl8bot
Closed
November 6, 2024, 7:54am
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.