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

Accessing Service Desk comment "Internal" status with velocity markup

Glenn Morrow
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2018

Does anyone k now how to access the Service Desk "Comments" property of "public" or "internal" comment? IN VELOCITY.

I can use either "$!comment" for the current comment or use "#foreach ($thisComment in $!commentManager.getComments($!issue))" to iterate through all comments and something like "$!comment.getAuthor()" or "$!comment.getBody()" works fine but "$!comment.getGroupLevel()" or "$!comment.getRoleLevel()" are always null and I can find no other method that gives the public/private status of a comment.

It also seems that in ScriptRunner (Groovy) you could do "def commentProperty = commentPropertyService.getProperty(user, comment.id, SD_PUBLIC_COMMENT).getEntityProperty().getOrNull()" but I don't know if you can access that in Velocity and have not worked out how.

Anyone have any ideas or is this just impossible? I simply want my outgoing emails to mark internal comments as such so when they are emailed out to Agents they can see it was an internal or public comment. We use JETI as our email handler but I can't find anything in there to do this either (I have asked them but no answer yet).

1 answer

1 accepted

1 vote
Answer accepted
Glenn Morrow
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 8, 2018

JETI support came up with:

$!templateSupport.isInternalComment($!comment)

That works a charm!

:) 

Stephanie Rathmann December 6, 2019

This isn't working for me. Is the something I need to do to enable $templateSupport ?

I'm very new to velocity, and would appreciate any help.

Glenn Morrow
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2019

Stephanie,

1. You are using JETI (JIRA Email This Issue) add-on, yes?

2. Its ages since I did this! But I note my comment above is "$!templateSupport" not "$templateSupport" as in your comment - i.e. dollar-exclamation_point, not just dollar.

3. If not that, here's a snippet of the code we use

#if($!templateSupport.isInternalComment($!comment))
#displayInternalCommentNotification()
#end

#displayInternalCommentNotification() is just some HTML (<tr> ...) with our message in it.

Hope that helps.

Glenn

Stephanie Rathmann December 7, 2019

Hey, thank you for replying so soon!

I realised after posting that we are using JEMH, and don't have JETI.

Does JETI have a way to attach the attachments to the email notifications? Then it might be worth us switching to JETI, unless you know of a way to make this work in JEMH?

Glenn Morrow
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2019

Ah yes, JEMH is another major player in the JIRA emailing game, along with JETI. I don't know anything about JEMH I am afraid. Not too sure exactly what you mean about "attach the attachments to the email notifications?" - JETI certainly includes attachments/ does add some attachments but its not a big requirement for us and I don't know if it covers the use-case you want. And I do know changing mail handlers is a big jump - better the devil you know I think. That said do like JETI - took us a while to configure everything but it works well now for us. Anyway that's about all the help I cna be. Good luck! :)

Mike Harrison _The Plugin People_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 9, 2019

Hello Stephanie,

It sounds like you are looking for this API method for determining JSD comment visibility?

An example of how this could be used in a notification template:

#if ($jemhUtils.isPrivateJSDComment($recipientUser, $comment))
## the comment was internal/private
#end

See here for more information, or alternatively raise a support request and we can guide you further.

Like Glenn Morrow likes this
Peter March 10, 2020

Hi,

jemhUtils.isPrivateJSDComment only works for JSD projects right? Is this also possible with JIRA Software projects and regular comment restrictions?

Thanks,

Peter

Mike Harrison _The Plugin People_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2020

Hi Peter,

Once you have the $comment, you can just call the relevant methods for the comment object, for example:

#if (!$comment.getRoleLevel() && !$comment.getGroupLevel())
    ## comment has no role or group level restrictions
#end
Like Peter likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events