Placeholder Value Functions

To calculate Dynamic values, you can use officeatwork specific functions as listed below as well as the functions described on the Nunjucks documentation pages. Each function must be encapsulated by two curly brackets on either side {{ function() }}. Please note that when you are using block functions like If() or Case() with curly bracket and percentage character {%  …  %} that functions within need only one set of curly brackets {%   { function() }   %}. Please also note that when nesting functions that {{ function(function()) }} that only the most outer function needs curly brackets:

field()

If you want to insert a reference to data the users selected or entered in the Wizard Add-In you can use the field() function.

Syntax

{{ field(‘InputFieldName’, ‘InputFieldGroup’).FieldName }}

Sample 1
This will output the value of the property ‘DisplayName’ of the ‘ContactPerson’ input field in the ‘From’ group:

{{ field(‘ContactPerson’, ‘From’).DisplayName }}

formatDateTime()

If you want to insert a reference to a date the users selected or entered in the Wizard Add-In you can use the formatDateTime() function. Visit the official Moments reference to learn more about all the formatting options available to you.

Syntax

{{ formatDateTime(‘ISO_Date’, ‘Format’, ‘Local_Code’) }}

If you want to insert a reference to a date the users selected or entered in the Wizard Add-In you can use the formatDateTime() function.

Sample 1
This will output the date as follows: 7/8/2017. This is the default format.

{{ formatDateTime(field(‘Date’).value, ‘l’) }}

Sample 2
This will output the date as follows: 2017 08 07

{{ formatDateTime(field(‘Date’).value, ‘YYYY MM DD’ ) }}

Sample 3
This will output the date as follows: Monday, August 7th 2017

{{ formatDateTime(field(‘Date’).value, ‘dddd, MMMM Do YYYY’) }}

Sample 4
This will output the date as follows: Montag, August 7. 2017

{{ formatDateTime(field(‘Date’).value, ‘dddd, MMMM Do YYYY’, ‘de-de’) }}

formatNumber()

If you want to insert a number in a formatted fashion you can use the formatNumber() function. Visit the official NumberFormat reference to learn more about all the formatting options available to you.

Syntax

{{ formatNumber('number', { 'options' }, 'locales') }}

Sample 1
This will output the number in this format: 12,345.68

{{ formatNumber('12345.678', { style: 'decimal', useGrouping: true, maximumFractionDigits:2 }, 'en-US') }}

Sample 2
This will output the number in this format: £ 12'345.68

{{ formatNumber('12345.678', { style: 'currency', currency: 'GBP', useGrouping: true, maximumFractionDigits: 2 }, 'en-UK') }}

if()

If you want to apply a condition like if in your placeholder you can use the if() function. 

Syntax

{% if variable %}
     It is true
{% endif %}

Sample 1
This will output the Contact person's birthday only if the Contact person is of type 'Private'.

{% if field(‘ContactPerson’, ‘From’).Type == "Private" %}
     {{ field(‘ContactPerson’, ‘From’).Birthday }}
{% endif %}

More Function

Learn more about other available functions in the Nunjuks documentation mentioned in the References section below.

References

Nunjucks: The templating engine used to evaluate the Value field is called Nunjucks. Learn more about how to write formulas with Nunjucks here: https://mozilla.github.io/nunjucks/templating.html

Moments formats: When using the formatDateTime() function you can find more details regarding the formatting parameters in the Moment.js documentation here: https://momentjs.com/docs/#/displaying/format/

Moments simulation: To learn more about the moments format and language support you can use the simulation offered at the bottom of the moments home page: https://momentjs.com (the language local can be found here: moment.locale() – in the Multiple Locale Support section)

NumberFormat: The numberFormat() function is based on a standardized browser functionality. You can find detailed description about the syntax here:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat