I have set up an ISSUE COMMENT DELETED event in scriptrunner listener. Every time when a user deletes the comment I have to update the backend system to delete the same comment.
Is there any way in scriptrunner listener to find out the comment body of deleted comment?
No, the event only holds the information about the event, not what the event was acting on.
You've deleted the comment. By the time the listener picks up the event, the data has gone.
I'd recommend the users of your "backend" system use Jira for the source of the data, rather than duplicate (and hence lose or obsolete) data.
Sorry but i need to correct Nic Brough on this one, the event does have information about the action you where executing. To get the old comment information u can use the following code:
Logger log = Logger.getLogger("runner.ScriptRunnerImpl")
Comment comment = event.params["originalcomment"]
log.info("Whats my id: " + comment.id)
log.info("Whats my body: " + comment.body)
It is not stored inside the comment but you are able to find it back in the event params as originalcomment. It is also always good to print the full event then you can see what information the event contains:
log.info("What is my event: "+ event)
Hope this helps other people to :), good luck everyone happy programming!
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