If you had custom fields in your document templates prior to October 28, 2019, you'll need to make some changes to them in order to continue using those templates. The best course of action will be to copy and paste your template content into a separate text editor, make the changes there, and paste the new template into Document Settings (as soon as your account has been upgraded and you're ready to use the new templates, we'll let you know).
You currently refer to a custom field like this in a template:
#{{ job.custom_text1 }}
In the old way, getting the right field name can take some trial and error. The new way requires a little more code, but less guesswork.
The following snippet will print out all of your custom field names and values. We recommend adding this into a template as a temporary first step, so you can see what all the field names are:
{% for assignment in job.custom_field_assignments %}
#{{ assignment.custom_field_configuration.name }}: #{{ assignment.field_value }}
{% endfor %}
Printing out just one field works like this:
{% for assignment in job.custom_field_assignments %}
{% if assignment.custom_field_configuration.name == "Warranty Expire Date" %}
#{{ assignment.custom_field_configuration.name }}: #{{ assignment.field_value }}
{% endif %}
{% endfor %}
This should look familiar--it's how you already print out specific job charges in a template.
Let us know if you need assistance, or if you have any questions at all. We're here to help.
Comments
1 comment
In case it's not readily apparent, customer-level custom fields are accessed in the same manner but using
Also, note that if you try to use handles like:
...what will be returned is the custom field whose entry has the numerically highest internal ID, and has nothing to do with the order the custom fields are listed on the job.
If you'd rather treat them as two arrays, one of the field names and one of the values, you can do this:
Please sign in to leave a comment.