Order number of Sales Invoice in email template

I am trying to include the order number of the sales invoice into the main message body of the Sale invoice email template.
Below the code that is used but the order number is blank in the email (but not on the actual in invoice).

{% for field in fields %}{% if field.label == ‘Order number’ %}{% capture order_number %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% capture if_order_number %}{% if order_number == null %}.{% else %} BOL {{ order_number }}.{% endif %}{% endcapture %}

Please find herewith attached your Invoice with number {{ recipient.code }}-{{ reference }} dated {{ invoice_date }}{{ if_due_date }}. BOL reference: {{order_number}}.


Apprecciate your help in pointing me in the right direction.

There is an easier way.

Just do:

{{ fields["Order number"] }}

2 Likes

Thank you! Folowing the same “logic” I tried variants to also display Due date (worked) and total to be paid (struggle with this see below). I tried {{ fields[" total “] }} and {{ fields[“total.text”] }} and {{ table.totals[” total “] }} and {{ totals[” total "] }} but the field stays empty in below body text in email template.

Please find attached {{ title }} #{{ fields[“Invoice number”] }}. Please make payment of {{ table.totals[" total "] }} before the due date of {{ fields[“Due date”] }} to:

Any help appreciated.

Try this for the total {{ table.totals[“Total”]}} the case may be important

See the guide Include calculations in custom themes | Manager

As always, the guides are full of knowledge

Thank you, I tried that as well, and just now again but remains blanc. I will now review the guide as suggested.

UPDATE: using the second option in the guide worked, ie I used {{ table.totals[“Balance due”] }} Thanks you, problem fixed.

Good day, have noticed recently that while creating sales invoice, the option for order number is no longer available, please

You have to select a customer to see the additional fields.

hello mate, still it is not available

The order number is next to the customer name. You are right that the additional optional order number box that was next to the reference box has disappeared in recent versions of Manager and this was explained in other discussions on the forum, just search and you see why it is made redundant by @lubos.

Only the previously created Sales Orders are listed in the Order number entry field. As @eko has already indicated, this all was explained in another forum thread.

this is how it used to appear on previous version, and currently i am on ver 22.7.12 which does not have order number option.
i am using iMac

Yes, this is deliberate what we alerted you about, this is no longer supported and you are encouraged to look in the other forum threads where this is explained in detail.

Thank you, and appreciated for your prompt response.
Have customized a field for the order number, and it works well.
The negative side of it is upon generating customer statements (unpaid invoices) the customized field for order number does not appear on the columns, rather the old column which does not populate new order numbers

Glad that you are making progress.

This is a known issue and also deliberated in other discussions.

thanks