It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Email template trouble

Rumceisz Jul 04, 2012

Hi All,

I have a big trouble with the HTML email template.

One of a project of our Jira instance need a custom create issue email template. They need only a few fields displayed, no hyperlinks and a custom field.

We inherited the Jira from a previous team but we aren't acquinted with HTML editing.

I attach the current email template and the HTML code - the top left part.

I signed the necessary fields and wishes on the attached pic.

Whenever we change something in the email template we get error message in the email.

4 answers

1 accepted

0 votes
Answer accepted
Jobin Kuruvilla [Go2Group] Community Leader Jul 04, 2012

All you need to do is to remove the unwanted fields - starting from #text to the next #text. For the key, you can replace #text("common.concepts.key") with Request Number

Rumceisz Jul 07, 2012

Hi Jobin,

it didn't work! I changed the #text("common.concepts.key") with Request Number and I got an error email. See attached txt!

Maybe is it in connection with the issuecreated.vm file? Because it contains only a few lines parsing these header, summary,etc. templates:

#parse("templates/email/html/includes/header.vm")
#parse("templates/email/html/includes/summary-topleft.vm")
#parse("templates/email/html/includes/summary-bottom.vm")
#parse("templates/email/html/includes/footer.vm")

I am so disapponted because I have no idea why I got error mails.

Thanks for help!

Rumi

0 votes
Rumceisz Jul 04, 2012

Sorry, this is the Top-left part's html code. I could attach only as pic.

Thanks in advance for your help!

Rumi

0 votes
Rumceisz Jul 07, 2012

this is what i get

Jobin Kuruvilla [Go2Group] Community Leader Jul 07, 2012

It complains about an extra #end. Is it working without that single change?

Rumceisz Jul 07, 2012

Yes it's working without the change.

IT is HTML email template I didn't mention.

What can be wrong?

Jobin,

have you got a private email. I would send you the summary-top-left.vm and the issuecreated.vm for you. The original summary-top-left.vm is what I pasted above.

Thanks in advance for your help!

RUmi

Jobin Kuruvilla [Go2Group] Community Leader Jul 07, 2012

Well, the problem is, there is an extra #end at line 474 ;) Can you attach the trmplate as a .txt file?

Rumceisz Jul 08, 2012

(summary_topleft.txt) (error_email.txt) (issuecreated.txt)

Hi Jobin,

I attach the 3 .txt files: the text of the last error email after I changed #text("common.concepts.key") with Request Number. Then I attach the Summary-topleft text and the issuecreated.vm

If you need additional files, let me know and I attach them too.

How can be a code error message like this:

An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 440, column 84. Encountered: "q" (113), after : "&" at org.apache.velocity.Template.process(Template.java:141) at

when I only changed #text("common.concepts.key") to 'Request Number'????

PS.: I made the changes in Word.

Thank you for your help!

Rumi

Rumceisz Jul 09, 2012

Hi,

if you need more infos, I attach.

Jobin Kuruvilla [Go2Group] Community Leader Jul 09, 2012

Oops..is that your vm file? Or did you take the html source from somewhere? !

Rumceisz Jul 09, 2012

Hi Jobin,

yes they are.

Let me know if something wrong with them or you need additional info!

I would send you in Word but the forum doesn't let.

In the meantime I realized that I shouldn't edit the .vm files in Word but in Notepad.

Thanks in advance!

Rumi

Jobin Kuruvilla [Go2Group] Community Leader Jul 09, 2012

That is one big file and I don't have time to debug it to be frank! Too big to know where the problem is without spending time. I suggest you do 2 things. First, remove everything except the issue key and make it working with the original #text tag. And then try replacing it as I suggested.

If that doesn't work, attach both the working version and the modified version. It will be easier to debug in that case.

Rumceisz Jul 09, 2012

Sorry, I sent you an incorrect part.

Weel the problem was that I edited the .vm file in Word. Now I edited in Notepad and I got the needed Request Number field!

My question is how can I remove the hyperlinks from the script?

<table cellpadding="3" cellspacing="0" style="border-top-style:none;border-right-style:none;border-bottom-style:solid;border-left-style:none;border-width:1px;border-color:#3c78b5;" width="100%">
                <tr>
                    <td style="background-color:#ddd;">
                        <b>#text("common.concepts.issue")</b>
                        (<b><a href="${baseurl}/browse/${issue.getKey()}">#text("template.view.online")</a></b>)<br/>
                    </td>
                </tr>

Jobin Kuruvilla [Go2Group] Community Leader Jul 09, 2012

Awesome! Remove a href and the matching closing tag. i.e.

<a href="${baseurl}/browse/${issue.getKey()}">

and

</a>

Jobin Kuruvilla [Go2Group] Community Leader Jul 09, 2012

Oh yeah, go ahead and remove it ;) Try just

$issue.assigneeUser.name

Try $issue.assigneeUser.displayName or $issue.assigneeUser.fullName depending on JIRA version if you want full name instead of user name.

Same for reporter.

Rumceisz Jul 09, 2012

Jobin,

thank you!

I also would like to remove the hyperlink from the Assignee and Reporter fields. How can I do that.

Here is the code but I don't dare to remove #authorlink. Can it be??

<tr style="vertical-align:top;">
                    <td style="font-weight:bold;white-space:nowrap;">#text("issue.field.assignee"):</td>
                    <td>
                        #if ($issue.assigneeUser)
                            #authorlink ($issue.assigneeUser.name)
                        #else
                            #text("common.concepts.unassigned")
                        #end
                    </td>
                </tr>
                <tr style="vertical-align:top;">
                    <td style="font-weight:bold;white-space:nowrap;">#text("issue.field.reporter"):</td>
                    <td>
                        #if ($issue.reporterUser)
                            #authorlink ($issue.reporterUser.name)
                        #else
                            #text("common.concepts.no.reporter")
                        #end
                    </td>
                </tr>

Rumceisz Jul 12, 2012

Hi Jobin,

thanks for the suggestion, it works great!

I'd like to ask you how to display the content of a custom field on an email template? How can I reference on the custom field?

Something like this??:

#if ($issue.getCUSTOMFIELDNAME())
                <tr style="vertical-align:top;">
                    <td style="font-weight:bold;white-space:nowrap;">#text("issue.field.resolution"):</td>
                    <td>
                        $textutils.htmlEncode($issue.getCUSTOMFIELDNAME().getNameTranslation($i18n), false)
                    </td>
                </tr>
                #end

Rumceisz Jul 12, 2012

Thank you Jobin

Rumceisz Jul 16, 2012

Hi Jobin,

thank you very much for your help so far!

I finally could create an email template we wanted.

There is only 3 problems left:

1. There is a frame which we cannot erase from the template (I marked it with an arrow in the attached pic)

2. We have a custom field called "Comment to reporter" which is a free text field. In the Jira we wrote the message in many lines but in the email it appears in one line which is not so pretty. How can we solve this?

3. The project leader needs a static field under the issue details: this is the "Lorem ipsum.." dummy text on the pic. It is in the footer.vm. The problem is that we need this static field from "wall-to-wall": I mean that from the left side of the email to the right side. Now this static field grew down.

Can you please suggest and help?

Thanks in advance!


Rumi

Ps: can you see the attached pic?

0 votes
Rumceisz Jul 16, 2012

Rumceisz Jul 16, 2012

Hi All,

any idea how can solve that the footer covers the whole mail form left to right?

Thanks in advance!


Rumi

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Software

Demo Den Ep. 5: Meet Jira Mobile

See how to use Jira on the go! Demo Den Episode 5 is here: meet Jira Mobile with  Jira  Product Manager Rayen Magpantay.  Demo Den is in our monthly series where a Jira PM demonstrates...

193 views 1 8
Join discussion

Community Events

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

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you