Onit Documentation

Working with Participants Liquid Examples

by David Goldfarb Updated on

Display One Participant with a Specific Role

{% assign displayemail = "" %}
{% for endorsement in endorsements %}
{% if endorsement.role == "Attorney"%}
{% if displayemail == "" %}
{{ endorsement.user.email }}
{% assign displayemail = endorsement.user.email %}
{% endif %}
{% endif %}
{% endfor %}

Display Name and Email of All Participants in a Specific Role

{% assign array_of_users = atom.role_users["Invoice Approver 1"] %}
{% for user_record in array_of_users %}
{{ user_record.name }}/{{user_record.email}}<br>
{% endfor %}

Accessing the user object using 'email_to_user'

{% assign my_user = '[email protected]' | email_to_user %} {{my_user.name}} - {{my_user.has_used_password}} 

Returns - "John Gilman - true"

Accessing a user's preferences using 'user_preferences_for_user'

Assuming a "User Preferences" app is configured as a User Preferences provider in Advance Builder you can use the filter "user_preferences_for_user" to get any of a user's attributes. You need to pass a user object to the filter, not just an email address, so "current_user" will work. But you can always use "email_to_user" to first get a user object then pass it to the filter.

  • Use with "current_user" 
{% assign my_user = current_user | user_preferences_for_user %} {{my_user.approval_authority}} 

Returns "10000"

  • Use with an email address 
{% assign my_user = '[email protected]' | email_to_user | user_preferences_for_user %} 

Returns "50000"

Display How Many People are in a Specific Role

{% for endorsement in endorsements %}
{% if endorsement.role == "Attorney" %}
{% assign count = count | plus: 1 %}
{% endif %}
{% endfor %}

Display All Current Approvers with Status

{% for endorsement in endorsements %}
{% if endorsement.requires_action and endorsement.active %}
{{ endorsement.user.email }} - {{ endorsement.status }}
{% endif %}
{% endfor %}

Display Approvers Still Pending

{% for endorsement in endorsements %}
{% if endorsement.requires_action and endorsement.active and endorsement.status == 'Pending' %}
{{ endorsement.user.email }}
{% endif %}
{% endfor %}

Return the Role and Name of Every Participant on a Transaction

{% assign all_participants = ''%}
{% for role in roles%}
{% assign participants_in_role = ''%}
{% for participant in role[1]%}
{% assign participants_in_role = participants_in_role | append: participant | append: "; "%}
{% endfor %}
{% assign size = participants_in_role | size | minus: 2 %}
{% assign participants_in_role = participants_in_role | slice: 0, size %}
{% assign all_participants = all_participants | append: '"' | append: role[0] | append: '" Participant(s): ' | append: participants_in_role | append: ". "%}
{% endfor %}
{% assign size = all_participants | size | minus: 1 %}
{{ all_participants | slice: 0, size }}

Hide a Button From All Users Except Those in a Certain Role

{% assign hideButton = true %}
{% for e in endorsements %}
{% if e.role == "Requester Approval" and e.email == current_user.email %}
{% assign hideButton = false%}
{% break %}
{% endif %}
{% endfor %}
{{hideButton}}

Initialize requester to current user

Place the following in the requester name's initial value field:

{{ current_user.name }}

Place the following in the submitter email's initial value field:

{{ current_user.email }}
Previous Article Liquid Variables, Filters, and Tags
Next Article Date Calculations Liquid Examples

© 2024 Onit, Inc.

docs.onit.com contains proprietary and confidential information owned by Onit, Inc. that is subject to copyright. Onit presents it exclusively to you for your sole use in conjunction with using Onit products. No portion of the materials contained herein may be used for any other purpose. No portion of the materials contained herein may be shared with third parties or reproduced in any form.