Scriptrunner add comment with role visability

Oleksiy Ohmush June 6, 2019

I added comment by

commentManager.create(issue, user, "Task transitioned BY ${currentUser.displayName}", false)

how to restrict comment visability by Project role? 

1 answer

0 votes
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 6, 2019

Use this method instead:


commentManager.create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent)

 

See for further information: https://docs.atlassian.com/software/jira/docs/api/7.1.4/com/atlassian/jira/issue/comments/CommentManager.html

Oleksiy Ohmush June 7, 2019

Thank you for advice, Jack

But i'm not familiar with scripting, i can't understand how properly use it.

I have project role with id 13001, and try to do this:

commentManager.create(issue, user, "Task transitioned BY ${currentUser.displayName}",,13001, false)
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 7, 2019

I believe you need to put null on places where you want to specify any data, try:

commentManager.create(issue, user, "Task transitioned BY ${currentUser.displayName}",null,13001, false)
Oleksiy Ohmush June 7, 2019

No comments at all with this syntax

Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
June 7, 2019

Is the user you are using in the role 13001? Note that if not, you won't be able to see the comment.

it throws any error when executing the postfunction?

Oleksiy Ohmush June 7, 2019

yes, i am in this role, but maybe there is some problem if role contains user groups?

No errors in transition logs, complete successfully 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events