Replace CCC plugin with script runner

sai kaushik giddalur January 6, 2020

I use CCC last comment plugin, is there any way that i can replace this plugin with scripted field from script runner.

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -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.
January 6, 2020

From memory, a scripted field that does something like

def allComments = CommentManager.getComment(issue)

gets you a list of all the comments.  What I can't remember is how it is sorted, but if it is by Id of the comments, then just grabbing the last element from it (as lastcomment) should get the comment, then you can say

return lastcomment.getBody()

To put the text into a scripted field.  You might also want to add lastComment.getAuthroFullName() and lastComment.getCreated(). (And have a think about looking at the last user to amend it instead of original author)

sai kaushik giddalur January 6, 2020

Can you please attach link or which can explain me briefly.

Thanks,

SAI 

Nic Brough -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.
January 6, 2020

You should create a new custom field of type "scripted field", then go into Admin -> Scriptrunner -> scripted fields, and add a script to it. 

That script should

  1. use CommentManager to get the comments from the issue
  2. Work out which one is last
  3. Return the body of the comment, along with any other data you want from it (author and last edited?)
sai kaushik giddalur January 8, 2020

Can i get the script?

sai kaushik giddalur January 8, 2020

Thanks Nic Brough, i tried your steps and i successfully get the latest comment using script runner.

Suggest an answer

Log in or Sign up to answer