Hi,
I'm trying to setup a custom event with template Issue Commented that is thrown (through a Script Listener) when a Issue Commented event is thrown, except for comments added by a specific user.
I've created the new event like:
Task Commented => Template = Issue Commented
...and I've added the related Script Listener:
Project: XXX
Event: Issue Commented
Condition:
import com.atlassian.jira.component.ComponentAccessor if (comments) { //return comments*.authorKey[-1] == "Anonymous" return ComponentManager.getCommentManager().getComments(issue).last().author == "Anonymous" } else { return false }
Event: Task Commented
I've associated to the new event the requested notifications and then had a test.
The result is:
Task Commented notification arrives but it has no comment in it's body:
TaskCommented.png
If I do the same test enabling notifications for event Issue Commented (the original one) I get the notification with the comment within it's body.
Why this?
How can I reach the requested result?
Thank you in advance
Regards
I actually think there is an issue here. There is a built-in script called something like "Fire a comment when..." that you can use to raise an event but only under specific circumstances.
If you choose the Issue Comment event, then the event is raised, but the vm mail templates try to get the comment from the event, but the event was raised without attaching any comment to it.
I think this is probably a bug.
Recently I posted an answer on how to use a custom script to raise an Issue Commented event that attaches the most recent comment: https://answers.atlassian.com/questions/11976112. Note that my original answer is not correct, the correct answer is in a gist in the comment.
Hi @Arianna Fabbri,
Is there any reason why you cannot use directly the System Issue Event? According to the condition from your code, you could simply configure that event to trigger that event for the "Single User" called Anonymous.
Custom events are mainly used to generate notifications for custom workflow transitions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jamie Echlin [Adaptavist]
thank you for your answer but I think that my case is a little bit different: I have to catch (in addition to generic events for which your link is very useful) all the standard Issue Commented event and distinguish from who it has been added and then decide if I have to notify it to the users or not...
How can I do that?
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's really the same question... you already have your condition, then you use the script to raise a new event, called eg Issue Anonymously Commented, which you catch in your notification scheme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Passing, wile raising it, the comment just added. Perfect, now I have understood. Thank you very much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been taking a look at @Jamie Echlin [Adaptavist] answer and that is definitely the correct one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alejo Villarrubia [Adaptavist]
I need to distinguish between internal comments (added by users directly from Jira) and comments added via email from Anonymous user.
I created a custom Task Internal comment Event and I would like to trigger the custom event only if the comment is added not by Anonymous (in the above condition I've made an error, it must be != "Anonymous").
In this way I can associate to the custom event, in the notification scheme, the users that have to receive notification for all the internal comment (not added from Anonymous)
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.