I have attached a template (.txt file) I’ll be using with Jeti - But I hope you guys can understand my logic even if you do not use JETI.
I will be using one template and on transition this template will be used but based on #else/elseif statements..
I have gotten as far to be able to use the email button feature for manual AD-HOC emails sent from within an issue using a section of the template, and as you can see others are based on IssueTypes and field values.. Which work perfectly.
However I have become stuck where I want to use a status to trigger a part of the template but this then triggers other parts of the template.. So in effect I get two emails.. which I don’t want.
So I thought about creating a custom field that on transition this field is updated with a value, which I have done, but I now want the template to include this custom field data to trigger a section of the template.
I have become so focused on this that I have completely got myself lost..
I have 3 custom field values;
Custom Field ID: 10700
3. Further Assessment
4. no value/emtpy/none (which ever works)
I have tried to replicate what I have done already but I have failed. As you are most likely more skilled than I, can you see just from a quick glimpse how or where I should place this extra content. Or is there a way that events can be included from within the template?
Any help or guidance or any documentation that I may not have uncovered would be very grateful.
Many thanks (Test Template.txt)
Managed to resolve with the following... Well... So to speak...
I still end up with some data included from other templates.
But the actual sections send upon transition using the correct fields.. Though I will attempt to maybe purge fields were possible to see if this resolves.
Attached revised .txt.
If anyone can see where an improvement can be made pleae feel free to let me know. Any help at all is much appreciated.
You could try to split business logic from HTML using macros: http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#velocimacros
// HTML templates
#macro(printHeader) Dear Sir/Madam</br> </br>ADHOC</br> <b>Re: $!issue.key $!issue.summary</b> received on <b>$dateformatter.formatDMYHMS($issue.getCreated())</b></br> </br> Thank you for contacting the European Medicines Agency.</br> </br> ... #end // add other macros printRestart, printResolve, printOther
// logic #if ($!mailBody.length() > 0) #printHeader() #else #set($intermediateStatus = $!jetiFieldRenderer.renderCustomField($issue, 'customfield_10700')) #if($intermediateStatus == "ReStart") #printRestart() #elseif( $intermediateStatus == "Resolve") #printResolve() #else #printOther() #endif #end
This way you can understand better how your template will work.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
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