Case: Created a custom .vm template, added it as an event in JIRA. But its not working.
atlassian-jira\WEB-INF\classes\email-template-id-mappings.xmlto make it a valid choice for when I’ll be adding a new event. Restarted JIRA service.
mytemplate.vm contains logic to shoot an email when a new issue is created. Basically just a copy of default issuecreated.vm, but with a different name. Just to see, if custom .vm template can also send an email notification.
In my notification scheme, I disabled the by default issuecreated.vm file for JIRA. Now my custom template must fire an email on issuecreate event. The problem is, when I create an issue, no email notification is being sent from JIRA.
Also note, SMTP configuration is working fine, because I am receiving email notifications on issueassigned, issuecommented, etc
I have checked the JIRA logs too, in order to find any error or deviation from normal behavior, but couldn’t see anything unusual. It would be very helpful, if anyone can provide any pointers in this regard.
This sounds a bit confused. An email template .vm is NOT an event, and it does not contain code to send emails off.
Events are fired inside JIRA. If there's a listener or other code listening for an event, that can do something with it. The standard built-in function is the notification scheme stuff. When that picks up an event, it reads the project notification scheme, and then builds an email with the appropriate users listed, and with content determined by the templates, and then it sends it.
The templates have nothing to do with the events directly.
JIRA is still firing "issue created" events. The question to my mind, is that after all your changes, what template is being used for "issue created"? Forget your new events, what template is used for the issue created event?
Hey, hello Nic, Sorry if my explanation leaded to confusion, I think I can explain it in more detail. It goes like this: I copied content of .../html/issuecreated.vm -> pasted it in .../html/mytemplate.vm I copied content of .../text/issuecreated.vm -> pasted it in .../text/mytemplate.vm I copied content of .../subject/issuecreated.vm -> pasted it in .../subject/mytemplate.vm Next step, I added below lines in ...\atlassian-jira\WEB-INF\classes\email-template-id-mappings.xml : <templatemapping id="18"> <name>My Custom Template</name> <template>mytemplate.vm</template> <templatetype>issueevent</templatetype> </templatemapping> Next step, I went to JIRA > System > Events : Selected 'Add New Event', gave, Name- My Custom Event from Template dropdown, i selected: 'My Custom Template'. Then clicked on 'Add'. Then, I created a notification scheme: My Custom Notification Scheme I added notifications for all JIRA defined events (except Issue Created) like Issue Updated, Issue Assigned, Issue Resolved, etc.(the notification was that an Administrator of a particular Project will get email). In the same list of events, last event was - My Custom Event. To this event too, i added the same notification that if fired, it should send an email to project's admin. Then I attached this notification scheme to the concerned JIRA Project. So, now when a new Issue is created in that project, no email is being sent. Although 'My Custom Event', which should ideally send a mail on issue creation (since it has the same code/content of issue created event), no mail is being sent from JIRA.
No, you're misunderstanding the whole system. Your custom event is all fine for adding a new event and getting a different email out. But that has nothing to do with "issue created". You say "should send a mail on issue creation since it has the same code as issue created". That's wrong. As I said before, the templates are templates for building emails. They have nothing to do with with the events. Issue creation fires the event "issue created". You've created "my custom event" and "template used by my custom event". You have set up any form of relationship between issue creation and your event (let alone template)
Oh, got your point. Please correct me if I'm wrong. 1. I should create a relationship between my custom event and the 'issue creation' action, (if i dont want to disturb JIRA's by-default issue created template). or 1. Do you mean that I cant create a whole new template for issue creation, since JIRA already has a by default template for issue creation. I can only add custom fields to the already existing .vm files. Is that the case? Also, can you share your email id if possible? I may require your help going forward in this regard. Thank you, Ashish (email@example.com)
I think you have understood it now. The problem with "create a relationship" for the create issue action is that it's all hard-coded in the core of JIRA. Your custom event is irrelevant, the "create issue" action will always fire "issue created" unless you hack the core (which I can not recommend) The better option is to amend the templates for the "create issue" action
Thanks a lot Nic for this clarification, saved me from wasting any further time on it. But to be true, why I started moving into this direction was, because my requirement is to send an email notification (with particular custom content) from JIRA, when a particular transition happens in a workflow (say, for example, when the transition moves from Testing to Deployed), keeping in mind, that I should not disturb the already existing JIRA .vm files. The reason being, there are many different teams using the same JIRA, all of them have different projects in JIRA. So playing with existing JIRA velocity templates, will affect all other projects in JIRA. As per our discussion on this page, what I infer is that the only way is to modify 'issueupdated' velocity template, since transition change in workflow will ultimately update the status in an issue. Any pointers/ help on how to achieve the requirement, it would be of great great help. Thanks again.
I think I just got my answer while doing some R&D! I attached my 'custom template' to a 'custom event' in JIRA. Then associated that 'custom event', as a post function to that particular transition on which I want to fire a custom email and this is working like a charm now! I'll elaborate it separately in my answer to this post!
Ahh, yes, I concentrated on the "issue create" because that is a *system* event, not a workflow event, and you can't change that without core coding. Workflow events are completely customisable - you can fire any event you want at the end of a transition, and hence tie your changes into it.
Hello Atlassian Community! My name is Ada , and I'm the Product Marketing Manager for Confluence Server at Atlassian. If you missed our last post, we're transitioning to quarterly updates&nb...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs