Notification schemes

Kgomotso Lekubu February 12, 2013

hello there

is there a way to send a default message when issues are created.

i have created a custom field but i don't see a field where i can add my default message.

kindly assist if know how one can add default message.

1 answer

3 votes
C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2013

hi.

please read

https://answers.atlassian.com/questions/82337/jira-e-mail-template-customfield-options

in case you don't want to read through all that stuff:

create a new vm file in your

<JIRA_INSTALL>a/tlassian-jira/WEB-INF/classes/templates/email/html/includes/fields

(by default that should be in /opt/atlassian/jira/)

create a template (keep in mind that jira offers html and text email. so a template for each should be built)

name it something like your customfield for example.

i will show you an example template:

#disable_html_escaping()
#if ($issue.getCustomFieldValue("customfield_&lt;ID&gt;"))
&lt;tr valign="top"&gt;
    &lt;td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;"&gt;
        &lt;strong style="font-weight:normal;color:${textSubtleColour};"&gt;#text("&lt;NAME&gt;"):&lt;/strong&gt;
    &lt;/td&gt;
    &lt;td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;"&gt;
        $issue.getCustomFieldValue("customfield_&lt;ID&gt;")
    &lt;/td&gt;
#end

to find out the ID of your customfield just navigate to Administration>Issues>Fields and highlight "Edit" on your customfield.

your browser status bar should show you something like i.e. :

https://your_jira_host/secure/admin/EditCustomField!default.jspa?id=11606

in that case 11606 is the ID of the customfield so add it to your code:

replace customfield_<ID> with customfield_11606 (note there are 2 occurances)

the <NAME> should be clear. add the customfields name here.

next step is to cd to:

<JIRA_INSTALL>/atlassian-jira/WEB-INF/classes/templates/email/html

you will find the issuecreated.vm here. open it with your preferred text editor (vi,vim,nano whatever)

at the bottom you will find:


&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;
                        #parse("templates/email/html/includes/fields/issuetype.vm")
                        #parse("templates/email/html/includes/fields/affectsversions.vm")
                        #parse("templates/email/html/includes/fields/assignee.vm")
                        #parse("templates/email/html/includes/fields/attachments.vm")
                        #parse("templates/email/html/includes/fields/components.vm")
                        #parse("templates/email/html/includes/fields/createddate.vm")
                        #parse("templates/email/html/includes/fields/description.vm")
                        #parse("templates/email/html/includes/fields/duedate.vm")
                        #parse("templates/email/html/includes/fields/environment.vm")
                        #parse("templates/email/html/includes/fields/fixversions.vm")
                        #parse("templates/email/html/includes/fields/labels.vm")
                        #parse("templates/email/html/includes/fields/priority.vm")
                        #parse("templates/email/html/includes/fields/reporter.vm")
                        #parse("templates/email/html/includes/fields/securitylevel.vm")
                        #parse("templates/email/html/includes/fields/timetracking.vm")
                    &lt;/table&gt;

simply add your previously created new vm file in between there and save the file.



now the easier part. for text emails go to:

<JIRA_INSTALL>atlassian-jira/WEB-INF/classes/templates/email/text

and edit the issuecreated.vm there. (looks different)

add this line (lets assume your customfield id is still 11606):

#if ($issue.getCustomFieldValue("customfield_11606")) $stringUtils.leftPad($issue.getCustomField("customfield_11606").name, $padSize): $issue.getCustomFieldValue("customfield_11606")
#end

Now restart Jira and enjoy

Suggest an answer

Log in or Sign up to answer