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

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 edit all comments to internal?


could you please help me tranfer all of my comments to internal? I tried following script I found on net but it is not working...


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.web.bean.PagerFilter

final jqlSearch = "jql"

def searchService = ComponentAccessor.getComponent(SearchService.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def commentManager = ComponentAccessor.getCommentManager();
def jsonManager = ComponentAccessor.getComponent(JsonEntityPropertyManager)

//JQL Search
def issues = null
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
    def searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
    issues = searchResult.issues.collect {issueManager.getIssueObject(}

//Setting comments to Internal
if (issues) {
    for (Issue foundIssue : issues) {
        def comments = commentManager.getComments(foundIssue)
        for (def comment : comments) {
            jsonManager.put(user, "", comment.getId(), "sd.public.comment", "{ \"internal\" : true}" , (java.util.function.BiFunction) null, false)



Thank you,


2 answers

1 accepted

0 votes
Answer accepted

Hello all,

my bad this script works but gives you null result. Just replace jql with your querry without quotes and you are good to go :)

Code is by

Hi, I tried to use this script and the comments' label was changed to internal. However when I tried to filter the issues using this "issueFunction in commented('visibility internal')" the filter didn't return any issue that was changed from the script. Do you know the reason why or what should be changed in order to filter the issues?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

682 views 7 23
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