Custom Fields

I am trying to use a few custom fields in the Customer section
I created
CompanyName
AttentionTo
DeliveryAddress
numbered them 1,2,3
in my invoice I entered

                    <div style="font-size: 14px"><b>Deliver To:</b></div>
                    <div style="font-weight: bold">Bill To: {{ customer.DeliveryAddress | newline_to_br }}</div>

to try and display the Delivery Address
I have tried all combinations of
custom_field.DeliveryAddress
customer.custom_field.DeliveryAddress
custom field[‘DeliveryAddress’]

etc etc
what is the syntax I need to use to allow the placing of custom codes into my HTML?
Thanks
Haydn

Specifics of HTML would depend on where you are trying to place this information in a form. What are you trying to accomplish? Because you can enter all that directly into the Address field for the customers when you define them. See the guide:

https://forum.manager.io/t/creating-and-using-customers/7018

Read the portion about adding additional information. (Note that one example shows a delivery route custom field in the wrong place. That guide has not yet been updated for the recent theme changes. The concept is still valid, though.)

I have a couple of customers who run their own business at night but during the day work for someone else.
they want their stuff delivered to their day job business address not their billed to address.

so I created customer fields as above.
then inserted them into the invoice in the second column

<table style="padding: 30px">
<thead>
    <tr>
        <td colspan="99">
            <table style="margin-bottom: 0px"><tr>
                <td style="font-weight: bold; font-size: 32px">{{ title }}</td>
                {% if business.logo != null %}<td style="padding-right: 30px; text-align: right"><img src="{{ business.logo }}" style="max-height: 100px; max-width: 1300px"></td>{% endif %}
            </tr></table>
            
            <table style="margin-bottom: 20px"><tr>
                <td>
                    <div style="font-size: 14px"><b>Bill To:</b></div>
                    <div><b>{{ recipient.identifier }}</b></div>
                    <div>Att: {{ recipient.name }} {{ recipient.code }}</div>
                    <div>{{ recipient.address | newline_to_br }}</div>
                    <div>{{ field.text | newline_to_br }}</div>
                </td>
                <td>
                    <div style="font-size: 14px"><b>Deliver To:</b></div>
                    <div style="font-weight: bold">{{ customer.ComaanyName | newline_to_br }}</div>
                    <div style="font-weight: bold">{{ customer.AttentionTo | newline_to_br }}</div>
                    <div style="font-weight: bold">{{ customer.DeliveryAddress | newline_to_br }}</div>
                </td>
                <td style="border-right-width: 1px; padding-right: 20px; text-align: right">
                    {% for field in fields %}
                    <div style="font-weight: bold">{{ field.label }}</div>
                    <div style="margin-bottom: 10px">{{ field.text }}</div>
                    {% endfor %}
                </td>
                <td style="padding-left: 20px; width: 200px">
                    <div style="font-weight: bold">{{ business.name }}</div>
                    <div>{{ business.address | newline_to_br }}</div>
                    <div>{{ business.identifier }}</div>
                </td>
            </tr></table>

            <div style="font-size: 14px; font-weight: bold; margin-bottom: 20px">{{ description }}</div>
        </td>
    </tr>
    <tr>
        {% for column in table.columns %}            
        <td style="font-weight: bold; padding: 5px 10px; text-align: {{ column.align }}; border-left-width: 1px; border-bottom-width: 1px; border-top-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if column.nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ column.label }}</td>
        {% endfor %}
    </tr>
</thead>
<tbody>
    {% for row in table.rows %}
    <tr>
        {% for cell in row.cells %}
        <td style="padding: 5px 10px; text-align: {{ table.columns[forloop.index0].align }}; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if table.columns[forloop.index0].nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ cell.text | newline_to_br }}</td>
        {% endfor %}
    </tr>
    {% endfor %}
    {% for column in table.columns %}            
        <td style="border-bottom-width: 1px; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}">&nbsp;</td>
    {% endfor %}
    {% for total in table.totals %}
    <tr>
        <td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
        <td style="border-color: #000; border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
    </tr>
    {% endfor %}

    <tr>
        <td colspan="99">
            <div style="font-weight: bold; padding-top: 20px"></div>
            <div><b>Acc Name : </b>Mr sdgsss sg sn</div>
            <div><b>BSB : </b>4000000</div>
            <div><b>Acc No : </b>000000000</div>
        </td>
    </tr>

    {% if emphasis.text != null and emphasis.positive %}
    <tr><td colspan="99"><div style="text-align: center; margin-top: 40px"><span style="color: #006400; border-width: 5px; border-color: #006400; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div></td></tr>
    {% endif %}

    {% if emphasis.text != null and emphasis.negative %}
    <tr><td colspan="99"><div style="text-align: center; margin-top: 40px"><span style="color: #FF0000; border-width: 5px; border-color: #FF0000; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div></td></tr>
    {% endif %}
        
</tbody>
</table>

Some helpfull code to customise your theme given by Lubos in this topic -

To show only single custom field see same topic here -

To show custom field only on “Invoice” see same topic here -

1 Like

Perfect Thanks.
I changed the section to…
And Now I can Have my custom fields displaying where I want and looking like I want.
As I said if you have a seperate billing and delivery address this worked a treat, putting it all in the Customer address field was not what I wanted as you couldn’t bold only certain lines.
Thanks For your Help
this Problem Resolved

                <td>
                    <div style="font-size: 14px"><b>Deliver To:</b></div>
                    {% for field in custom_fields %}
                    {% if field.label != 'CompanyName' %}{% continue %}{% endif %}
                    <div><b>{{ field.text }}</b></div>
                    {% endfor %}
                    {% for field in custom_fields %}
                    {% if field.label != 'AttentionTo' %}{% continue %}{% endif %}
                    <div>Att: {{ field.text }}</div>
                    {% endfor %}
                    {% for field in custom_fields %}
                    {% if field.label != 'DeliveryAddress' %}{% continue %}{% endif %}
                    <div>{{ field.text | newline_to_br }}</div>
                    {% endfor %}
                </td>
1 Like

Yes, you can. Address fields will accept HTML. Just be aware as you check out the results that the changes are not retroactive. In other words, you cannot bold a line in the address and see it show up in an existing invoice. You must first edit that invoice by reselecting the customer. The change will be visible on all future invoices for that customer.

This seems a much simpler solution than writing code for entire new themes.