Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get deleted comment id?

Влад Демидик July 7, 2018

Hi everyone

I trying to get comment id on EventType.ISSUE_COMMENT_DELETED_ID but i got null. Does it exist another way to get id?

 

Thanks

4 answers

0 votes
Kashev Dalmia _Soteri_
Atlassian Partner
November 1, 2022

I found an answer here. That answer is particular to ScriptRunner, so I'm converting to regular Java for plugins in my answer here.

@EventListener
public void handleCommentDeleted(IssueEvent event) {
if (!EventType.ISSUE_COMMENT_DELETED_ID.equals(event.getEventTypeId())) {
return;
}
Comment comment = (Comment) event.getParams().get("originalcomment");
log.info("Comment: {}", comment);
}

I must say, it is an almost inexplicable design choice to have `issueEvent.getComment()` return null and requiring this parameter casting business instead.

0 votes
Joe Pitt
Community Champion
July 9, 2018

I don't. However, why are you trying to get it? when the comment is deleted it is gone. Are you trying to copy it somewhere? 

Влад Демидик July 9, 2018

Yes i have copy in active objects.

 

I develop plugin for synchronization jira and third-party service by api. I have jira_comment_id - my_service_comment_id link. I can make api request on that service and process them but it will be too long. 

 

I'm trying to find another solution using atlassian sdk.

0 votes
Joe Pitt
Community Champion
July 9, 2018

I don't use listener, but I'd verify that event actually happens in the listener documentation for the level of JIRA you're on. I could be that the comment is being deleted while the listener is firing and the ID is now set to null. 

Влад Демидик July 9, 2018

Yes, i think the same. But mb you know how it's possible to get comment id?

Mb it is possible to obtain actions log?

0 votes
Joe Pitt
Community Champion
July 7, 2018

JIRA erases everything from a deleted issue. I suspect it does the same thing for comments. where did you get the location from?

Влад Демидик July 9, 2018

It's code in my @EventListener:

image.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events