There are situations in which you expect a default value shown in an input of a certain text template, to also show that exact same value when you refer to it in another text template. But it doesn’t.
It is important to note that a default value is not stored in the database of your company at all.
This is explained in more detail here:
The reason this case is created, is specifically for text templates: text templates have a disadvantage of code to be re-created in another template if you wish to refer to that default value or the actual value.
Where as reconciliations and account templates can have result tags, that take the correct value of an input.
A clear example
in the company information there is an input that has the value of kind of shares, and we wish to display that value (default or an actual input) in another template
Here’s the snippet of that code:
| **{% t "Aard aandelen" %}**
{% assign stock_type_from_sync = person.custom.stock_type %}
{% assign def_stock_type = "" %}
{% case stock_type_from_sync %}
{% when 1 %}
{% assign def_stock_type = "Volle eigendom" %}
{% when 2 %}
{% assign def_stock_type = "Naakte eigendom" %}
{% when 3 %}
{% assign def_stock_type = "Vruchtgebruik" %}
{% when 4 %}
{% assign def_stock_type = "Onverdeeldheid" %}
{% endcase %}
| {% input person.custom.kind_of_shares as:select default:def_stock_type options:"Volle eigendom|Naakte eigendom|Vruchtgebruik|Onverdeeldheid" %}
As you can see, that input does use a default value:
default:def_stock_type
So that means if you refer to that input variable in another template like this:
{{ person.custom.kind_of_shares }}
you won’t see the default value. Only when you change the value manually, will it be seen (as you then are creating an actual input, so the changed value is stored on the database).
How to fix?
There is no other way than to re-create the code that created the default in this case:
{% assign stock_type_from_sync = person.custom.stock_type %}
{% assign def_stock_type = "" %}
{% case stock_type_from_sync %}
{% when 1 %}
{% assign def_stock_type = "Volle eigendom" %}
{% when 2 %}
{% assign def_stock_type = "Naakte eigendom" %}
{% when 3 %}
{% assign def_stock_type = "Vruchtgebruik" %}
{% when 4 %}
{% assign def_stock_type = "Onverdeeldheid" %}
{% endcase %}
Only then can the default value be used and will the template display the correct information.