Email Template

I am only just getting around to setting up email for my sales invoices and I’m sorry if this question has been answered many times before…

I have seen that I can put {{reference}} in the template title and body but I would also like to be able put in the invoice date, total amount and invoice due date. Something like

     Please find attached sales invoice number {{reference}} dated {{issue date}} for£{{invoice total}} due for payment on or before {{due date}} 

I have spent the last hour searching the forum and can’t find the answer. Can someone point me in the right direction please.

Thanks
Alan

In general, you need to look at the code for a theme to see how variables are named. Many variables, however, are arrays (including the totals variable). So you need to identify which element of the array is to be displayed. And that can change, depending on tax codes, tax inclusivity/exclusivity, discounts offered, rounding options, partial payments received, etc. In my opinion, the effort of adding such obvious information, already available on the invoice itself, is not worth it. Your customer’s accounting department is not going to consider information from the email. They will look at the invoice itself.

Fair enough. Thanks for the reply.

Alan

I use this

CompanyX Sales Invoice {{reference}} {{ fields[“Invoice date”] }}

and find that is sufficient for most customers.

I’m afraid the {{ fields[“Invoice date”] }} part doesn’t work :slightly_frowning_face:

Use CompanyX {{ title }} #{{ fields[“Invoice number”] }} {{ fields[“Invoice date”] }}

Looks like the variables are no longer exposed to the email template

Nope. Sorry @eko. That just gives: " Invoice # " in the body of the email.

The only things that work for me are {{reference}} and {{business.name}}

My line should be in the Subject not the body.

In the body using Manager v21.7.52 I use something like:

Dear {{ recipient.name }},

Please find attached CompanyX {{ title }} #{{ fields["Invoice number"] }}. Please pay the balance of $ {{ table.totals["Balance due"] }} due on {{ fields["Due date"] }} to: 

etc

Doesn’t work either

So far the following field references work for me (destop v.21-7-19)
{{reference}}
{{business.name}}
{{recipient.name}}
{{title}}

Searching for Email template renders more than 50 results. Have a look at this topic

Success!!

Thanks @Mark I found @Sharpdrivetek’s post and with a bit of fiddling around I now have the following working. I am not sure how show the HTML code for LTbrGT = break without it activating in this message so I have typed |break| instead.

Greetings {{ recipient.name }} |break| |break|

Please find attached {{business.name}} invoice number {{reference}} dated
{% for field in fields %}{% if field.label == ‘Invoice date’ %}{{ field.text }}{% endif %}{% endfor %}.
|break| |break|

The Invoice value is
{% for total in table.totals %}{% if total.label == ‘Total’ %}{{ total.text }}{% endif %}{% endfor %}
and is due for payment on or before
{% for field in fields %}{% if field.label == ‘Due date’ %}{{ field.text }}{% endif %}{% endfor %}.
|break| |break|

Thank you |break| |break|
Alan |break|
-----------------------------|break|
Alan Budden|break|
MyEmailAddress|break|
MyTelNumber|break|
----------------------------- |break|

and I have just notice that LTbGT LT/bGT switch bold on and off

Good to read that you’ve found out how to use the code. However, I find it strange that {{ fields["Invoice date"] }}, etc. for the fields on the invoice doesn’t work 'cos both in my Windows 10 Desktop v20.8.67 and Linux Server v21.7.46 they are working fine. You just have to use the exact same text as mentioned on the invoice, e.g. ‘Invoice date’ and not ‘Invoice Date’. BTW, the correct code notation is leaving a space after {{ and before }}

To type and see code in a message on the forum, you can use the Preformatted text (Crtl+E) icon </>

Magic! “Invoice date” does work. As you say, you just have to be careful to match the case.

So my email template is now:

Greetings {{ recipient.name }}
<br><br>

Please find attached {{ business.name }} invoice number {{ reference }}
dated {{ fields[“Invoice date”] }}.
<br><br>

The Invoice value is
{% for total in table.totals %}{% if total.label == ‘Total’ %}<b>{{ total.text }}</b>
{% endif %}{% endfor %}
and is due for payment on or before <b> {{ fields[“Due date”] }}</b>.
<br><br>

Thank you <br><br>
Alan <br>
----------------------------- <br>
Me <br>
MyEmailAddress <br>
MyTelNumber <br>
----------------------------- <br>

If you want, you could replace this with {{ table.totals[“Total”] }} :wink:

Not quite.
The longer version results in £1,234.00 and the short version gives 1234
And I think it should be single quotes, ‘Total’
Thanks for trying

Alan