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

How to change comment property with ScriptRunner for cloud? Edited

Kirill Ilinich Mar 24, 2018

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

1 vote
Answer accepted
Kristian Walker Community Leader 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 Community Leader 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

Kirill Ilinich Apr 11, 2018 • edited

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()

 

0 votes
Sergio Palacio Jul 19, 2018

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira Service Desk

4 changes to queues and issues you don’t want to miss

Hello Atlassian Community! I'm Tania, a Senior Product Marketing Manager for Jira Service Desk Cloud! I'm excited to announce some exciting improvements coming up for those who work with queues and...

644 views 9 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you