Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,637,894
Community Members
 
Community Events
196
Community Groups

How to change comment property with ScriptRunner for cloud?

Edited

We got used to post comments with Ctrl+Enter in Jira and now, after migration to JSD (cloud version), this shortcut submits internal comment, but we need external. So I try to use scriptrunner script (via REST API, since there is no other way in cloud edition), but not succeed. How to change it? Any ideas?

2 answers

1 accepted

3 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 11, 2018

Hi Kirill,

Can you please refer to the example located here.

I have just tested this example in the script console using the Update Issue example and have found that when I set the  properties for the comment to be as per below that it posts the comment as a public comment rather than an internal comment.

 properties: [
            [key: "sd.public.comment", value: [ "internal": false ]]
        ]

I have also found that using the update comment rest API located here that I was able to update an internal comment to mark it as a public comment using the example rest call below.

def result = put("/rest/api/2/issue/${issueKey}/comment/<commentIDHere>")
    .header("Content-Type", "application/json")
    .body([
        body: "Changing ID from an internal comment to a public comment",
        properties: [
            [key: "sd.public.comment", value: [ "internal": false ]]
        ]
    ]).asString()

This method should allow you turn internal comments into public comments.

Thanks

Kristian

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 11, 2018

Hi Kirill,

If this answer has managed to answer your question can you please mark it as accepted so that other users searching for a similar question can see that this has been marked as a correct answer.

Kristian

yep, thank you, that works just fine!

Make all comment external by default:

put("/rest/api/2/issue/$issue.key/comment/$comment.id")
.header(
"Content-Type", "application/json")
.body([body: comment.body, properties: [[key: "sd.public.comment", value: ["internal": false ]]]])
.asString()

 

What happend if I need to add the value of a custom field to the body? (comment)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events