Onit Documentation

Emails and Links Liquid Examples

by David Goldfarb Updated on

Approval Button: {{ 'Approve' | button_link : approve_url }}

Reject Button: {{ 'Reject' | button_link : reject_url }}

Note: for these two buttons above to render, they must be in a Send Notification action that is sent to a Role (such as Approver or Actor) and is fired by a Participant Activated Business Rule.

View Request Button: {{ 'View Request' | button_link : view_request_url }}

Add Buttons to Emails

{{ 'Onit' | button_link: 'http://onit.com' }}

You can also embed {{ 'button text' | wizard_link: atom }} in a notification, which will create an anchor link that will take the user directly to the launch form in edit mode without rendering the atom view. See also edit_form, which can be appended to the end of an atom URL and will render the atom in launch form view.

in addition to wizard_link there is wizard_url, e.g., {{ atom | wizard_url }} which will generate a URL instead of a link. The URL can then be used with button_link, e.g., 

{% assign my_url = atom | wizard_url %}{{ 'Press Me' | button_link : my_url }}

wizard_link and wizard_url will always require authentication when sent in a Send Notification Action. If they are used in a Send Report, and "do not require login" is on when the report is generated, then in this case the links can be followed without authenticating.

From a suite

Use widget_atom_link (to render second mover) form or widget_atom_link_popup (render full atom view in popup form.) E.g., 

{{ 'Edit' | widget_atom_link: atom}}

 {{ task.name | widget_atom_link: task }}

Get Email Attachment IDs

This Liquid will get the attachment IDs of documents sent to a Record via email.

{% assign mail_id = atom.emails.last.id %}
{% for doc in documents %}
{% if doc.attachment_owner_id == mail_id %}
{{ doc.id }}
{% endif %}
{% endfor %}

Project Emails

Approve email: {{email_address.account}}.approve@{{email_address.subdomain}}.app.onit.com

Reject email: {{email_address.account}}.reject@{{email_address.subdomain}}.app.onit.com

Non-Anonymous attachment download URL

The user must be logged into Onit to use this link, it is not anonymous. 

{% attachment_link generated_document %}

This provides a link to the content of an Attachment Field (in this example named generated_document).

You can also get a link to the attachment provided in a comment:

{% assign comment = comments.last %}{% comment_attachment_link %}

This will present a link that looks like the one in the comment feed, which can be clicked on for a download.

The assign statement here must use specifically comment, and other variables won't work.

The attachment_link and comment_attachment_link tags each verify the recipient address of the email matches the email address of the user downloading the attachment. If the email is forwarded to another person, that person will not be able to download any attachment regardless of permissions in Onit.

This check does not apply to system admins.

Generate Anonymous Attachment Download URL

This Liquid will generate an anonymous URL that will let anyone download the contents of an attachment Field. Parameters: the field name, the expiration period. The expiration period is expressed in days. The default is 45 days. The parameter accepts a decimal: .5 for 12 hours, .001 for 86 seconds, etc. You can also say "never".

{% capture url %}
{% anonymous_attachment_url atom, [attachment field name], [expiration] %}
{% endcapture %}
<a href="{{url}}" download>Anonymous Download Link</a>

Launch App Form from Suite Widget

This Liquid creates a clickable link that will launch an App without navigating the user away from their dashboard. This only works in the context of a suite portal widget, not an atom portal widget.

{{ "click here" | widget_atom_launch: "[app name]" }}

Launch App Form from Suite Widget with Initial Parameters

It's possible to set up a launch from a suite portal widget that also includes predefined values to put into certain fields. To do this, use an assign tag to put an array of key-value pairs into a variable called params_str . Here's an example of what to do:

{% assign params_str = '{
"requester_name": "Bob Frost",
"name": "New Atom 1",
"requester_email": "[email protected]",
"p_private_matter": 1,
}' | strip %}
{{ 'click here' | widget_atom_launch: 'App Name', params_str }}

To create anonymous launch with included parameters, use the {% create_launch_url %} tag, along with subtags {% app %} and {% param %}. An example:

{% create_launch_url my_link %}
{% app '[app name]' %}
{% param name = 'Test Atom' %}
{% param requester_name = 'Alice' %}
{% param checkbox = true %}
{% endcreate_launch_url %}

This example constructs a link which is stored in my_link. You can then use my_link in a hyperlink:

<a href = "{{my_link}}">Click Here</a>

Or a button link, as shown above:

{{ 'Click Here' | button_link: my_link }}

Execute Reaction URL

Create an email button that will trigger an action, and then redirect the user afterwards.

Format as follows:

{{ atom | execute_reaction_url: 'action name', 'redirect type', 'authentication' }}

Redirect Types:

Message: This leaves the user on a blank page that displays the last message given.

Atom: This places the user on the Record detail page (honors suite preferences, if relevant).

Dashboard: This places the user on the App dashboard (honors suite preferences, if relevant).

For example, we have already configured a "Return Message" action and named it "Show me a message". Now we set up a Business Rule that fires a notification action. The notification action includes this:

{% assign button_url = atom | execute_reaction_url: 'Show me a message', 'message' %}
{{ 'Click here' | button_link: button_url}}

When the user receives the notification in their email, they will see the button. When they click on it, they will be taken to a page that is blank, except for the message sent by the "Show me a message" action.

The authentication parameter is not required. If you do set it, there are two options:

  • authenticated_user
  • email_recipient

Authenticated_user: The user must log in before anything else happens. If you leave the parameter out, this is also what happens.

Email_recipient: The action will fire and the user will be redirected to their message without requiring a login.

If you set email_recipient but redirect to atom or dashboard, the user will have to log in before getting redirected, as you might expect. This means a slightly different flow for the two cases:

  • authenticated_user: email button clicked ➙ login ➙ reaction executes ➙ user is placed on the atom
  • email_recipient: email button clicked ➙ reaction executes ➙ login ➙ user is placed on the atom

There are two gotchas here:

  1. If using email_recipient for the authentication, in the Send Notification action, you cannot use "Recipient Roles" as the recipient target of the notification.
  2. If the reaction includes a Return Message action, the message will be returned before the login happens, and in the process of logging the user in and redirecting them, the message gets lost, and the user never sees it.
Previous Article Working with Fields Liquid Examples
Next Article Miscellaneous 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.