Available Liquid objects

Liquid objects contain attributes to output dynamic content to the page. For example, the pageobject has an attribute called title that can be used to output the title of the current page.

To access an object attribute by name, use a dot . To render an object's attribute in a template, wrap it in {{ and }}.

{{ page.title }}

Attributes of an object can also be accessed using a string name and []. This is useful in cases where the desired attribute is determined dynamically, or the attribute name contains characters , spaces, special characters, etc., that would be invalid when using the . syntax.

{{ page["title"] }}

{% assign attribute_name = "Name with spaces" %}

{{ object[attribute_name] }}

The following objects can be used and accessed anywhere, in any template.

Object Description
entities Allows you to load any Dynamics 365 entity by ID. More information: entities
now A date/time object that refers to the current UTC time,at the time the template is rendered.
Note: This value is cached by Portal Web App and is not refreshed every time. More information: Date filters
page Refers to the current portal request page. The page object provides access to things like the breadcrumbs for the current page, the title or URL of the current page, and any other attributes or related entities of the underlying Dynamics 365 record. More information: page
params A convenient shortcut for request.params. More information: request
request Contains information about the current HTTP request. More information: request
settings Allows you to load any Site Setting by name. More information: settings, Configure site settings for portals
sitemap Allows access to the portal site map. More information: sitemap
sitemarkers Allows you to load any Site Markers by name. More information: sitemarkers
snippets Allows you to load any Content Snippet by name. More information: Customize content by using content snippets
user Refers to the current portal user, allowing access to all attributes of the underlying Dynamics 365 contact record. If no user is signed in, this variable will be null. More information: Liquid types
weblinks Allows you to load any Web Link Set by name or ID. More information: weblinks
website Refers to the portal Website record, allowing access to all attributes of the Dynamics 365 Website (adx_website) record for the portal. More information: website

All Liquid Objects

ads

blogs

entities

entitylist

entityview

events

forloop

forums

knowledge

page

polls

request

searchindex

settings

sitemap

sitemarkers

snippets

tablerowloop

user

weblinks

website

ads

Provides the ability to access and render an ad.

The ads object allows you to select a specific ad or ad placement:

<div>

{% assign ad = ads["Ad Name"] %}

<h4>{{ ad.title }}</h4>

<a href="{{ ad.redirect_url }}">

<img src="{{ ad.image.url }}" alt="{{ ad.image.alternate_text }}" />

</a>

</div>

Ads attributes

Attribute Description
placements Returns the adplacements object.
[ad name or id] You can access any ad by its Name or Id properties.
{% assign ad = ads["Ad Name"] %}
{% assign ad = ads["da8b8a92-2ee6-476f-8a21-782b047ff460"] %}

Ad Placements attributes

Attribute Description
[ad placement name or id] You can access any adplacement by its Name or Id properties.
{% assign placement = ads.placements["Placement Name or Id"] %}
{% assign placement = ads.placements["2423d713-abb3-44c3-8a7d-c445e16fccad"] %}

Ad Placement attributes

An ad placement is an entity object, with all of the same attributes, in addition to those listed below.

Attribute Description
Ads Returns the collection of ad objects associated with the placement. Iteration tags and Array filters may be used with this collection.
Name Returns the Name field for the ad placement.
placement_url The URL that can be used to retrieve the ad placement fully rendered by a template.
random_url The URL that can be used to retrieve a random ad from the placement fully rendered by a template.

Ad attributes

Note

An ad is an entity object, with all of the same attributes, in addition to those listed below.

Attribute Description
ad_url The URL that can be used to retrieve the ad fully rendered by a template.
Copy Returns the Copy field for the ad.
image Returns the image object (if any) for the ad.
Name Returns the Name field for the ad.
open_in_new_window Returns true if the URL specified by redirect_url should open in a new window.
redirect_url The URL that the user will be directed to by clicking on the ad.

Ad Image attributes

Attribute Description
alternate_text Return the text that is intended to appear in the tag's alt attribute.
height Returns the height in pixels for the image
url Returns the URL source for the image.
width Returns the width in pixels for the image

blogs

Provides the ability to access and render Blogs and Blog Posts.

The blogs object allows you to select a specific blog or blog posts.

{% assign posts = blogs.posts | paginate: 0,4 %}

<div class="content-panel panel panel-default">

<div class="panel-heading">

{% assign sitemarker = sitemarkers["Blog Home"] %}

{% assign snippet = snippets["Home Blog Activity Heading"] %}

<a class="pull-right" href="{{sitemarker.url}}"> All Blogs </a>

<h4>

<a class="feed-icon fa fa-rss-square" href="{{ blogs.feedpath }}" />

{{ snippet.adx_value }}

</h4>

</div>

<ul class="list-group">

{% for post in posts.all %}

<li class="list-group-item" >

<a class="user-avatar" href="{{ post.author_url }}">

<img src="{{ post.user_image_url }}" />

</a>

<h4 class="list-group-item-heading">

<a href="{{ post.app_relative_path }}">{{ post.title }}</a>

</h4>

<div class="content-metadata">

<abbr class="timeago">{{ post.publish_date }}</abbr>

&ndash;

<a href="{{ post.author_url }}"> {{ post.author_name }} </a>

&ndash;

<a href="{{ post.application_path }}#comments">

<span class="fa fa-comment" aria-hidden="true"></span> {{ post.comment_count }}

</a>

</div>

</li>

{% endfor %}

</ul>

</div>

blogs Object

The blogs object allows you to access any specific blog in the portal, or to access all blog posts in the portal (regardless of the blog).

The following table explains the attributes associated with the blogs object.

Attribute Description
posts Returns a blogposts object containing all blog posts in the portal.
[blog name or id] You can access any blog by its Name or Id properties.
{% assign blog = blogs["Blog Name"] %}                             

{% assign blog = blogs["da8b8a92-2ee6-476f-8a21-782b047ff460"] %}  |

blog Object

The blog object allows you to work with a single blog, allowing you to access the posts for that blog.

The following table explains various attributes associated with blog Object.

Attribute Description
posts Returns a blogposts object containing all blog posts for the blog.
Name The name of the blog.
title The title of the blog.
url The URL of the blog.

blogposts Object

The blogposts object allows you to access a collection of blog post objects. You can order the blog posts and achieve pagination as well using liquid filters:

{% assign blogposts = blogs.posts | order_by “adx_name”, “desc” | paginate: 0,4 | all %} Note that blogs.posts.all is also a valid way to get all blog posts blogs.posts | from_index: 0 | take: 2 is also possible

The following table explains various attributes associated with blogposts Object.

Attribute Description
All Returns all blogpost objects in the collection

blogpost Object

Refers to a single blog post.

The following table explains various attributes associated with blogpost Object.

Attribute Description
url The URL of the post.
content Returns the content field for the post.
content Returns the Content field for the post.
author Returns the authorf for the post (which is simply a contact entity object.
title The Title of the post.
comment_count Returns the integer value of the count of how many comments there for a given post.
publish_date The date at which the post was published.

entities

Allows you to load any Dynamics 365 entity by ID. If the entity exists, an entity object will be returned. If an entity with the given ID is not found, Liquid types will be returned.

{% assign account = entities.account['936DA01F-9ABD-4d9d-80C7-02AF85C822A8'] %}

{% if account %}

{{ account.name }} ({{ account.statecode.label }})

{% endif %}

{% assign entity_logical_name = 'contact' %}

{% assign contact = entities[entity_logical_name][request.params.contactid] %}

{% if contact %}

{{ contact.fullname }} ({{ contact.parentcustomerid.name }})

{% endif %}

Entity

An entity object provides access to the attributes of a Dynamics 365 entity record.

Attribute Description
Id The GUID ID of the entity, as a string. e.g. 936DA01F-9ABD-4d9d-80C7-02AF85C822A8
logical_name The Dynamics 365 logical name of the entity.
Notes Loads any notes (annotation) associated with the entity, ordered from oldest to newest (createdon). Notes are returned as note objects.
permissions Loads Entity Permission assertion results for the entity. Results are returned as a permissions object.
url Returns the Dynamics 365 portals content management system URL path for the entity. If the entity has no valid URL in the current website, returns null. Generally, this will only return a value for certain entity types that have been integrated into the portal CMS , unless you have customized the URL Provider in your application.
[attribute or relationship name] You can access any attribute of the Dynamics 365 entity by logical name. {{ entity.createdon }}{% assign attribute_name = 'name' %}{{ entity[attribute_name] }}
The values of most entity attributes map directly to Liquid types: Two Option fields map to Booleans, text fields to strings, numeric/currency fields to numbers, date/time fields to date objects. But, some attribute types are returned as objects:
  • Lookup (Entity Reference) fields are returned as entity reference objects.
  • Option Set/Picklist fields are returned as option set value objects.
  • You can also load any related entities by relationship schema name.
  • {{ page.adx_webpage_entitylist.adx_name }}In the case that a relationship is reflexive (i.e. self-referential), a reflexive relationship object will be returned. (Otherwise, the desired result would be ambiguous.){{ page.adx_webpage_webpage.referencing.adx_name }}
    Note: Loading large numbers of related entities, or accessing large numbers of relationships in a single template, can have a negative impact on template rendering performance. Avoid loading related entities for each item in an array, within a loop. Where possible, use Dynamics 365 entity tags to load collections of entities.

Entity Reference

Lookup attribute values are returned as entity reference objects, with the following attributes.

Attribute Description
Id The GUID ID of the referenced entity, as a string.
e.g. 936DA01F-9ABD-4d9d-80C7-02AF85C822A8
logical_name The Dynamics 365 logical name of the referenced entity.
Name The primary name attribute of the referenced entity.

Note

A note is an entity object that provides access to the attributes and relationships of an annotation record. In addition to all the attributes of an entity object, a note has the following additional attributes.

Attribute Description
documentbody Loads the documentbody attribute of the note annotation record, as a Base64-encoded string. As the content of this attribute may be large, it is not loaded with the rest of the note attributes, and only loaded on demand.
Note: Use of the documentbody attribute could have a negative impact on template rendering performance, and should be done with caution.
Use the url attribute to provide a link to the note attachment instead, if possible.
url Returns the URL path for the built-in portal annotation attachment handler. If the user has permission, and the note has an attached file, a request to this URL will download the note file attachment.

Option Set Value

Option Set/Picklist attribute values are returned as entity reference objects, with the following attributes.

Attribute Description
Label The localized label of the option set/picklist attribute value. e.g. Active
Value The integer value of the option set/picklist attribute value. e.g. 0

Entity Permissions

The Entity Permissions object provides access to aggregated permission assertion results for an entity.

Attribute Description
can_append Returns true if the current user has permission to append records to relationships of this record. Returns false otherwise.
can_append_to Returns true if the current user has permission to append this record to a relationship of another entity. Returns false otherwise.
can_create Returns true if the current user has permission to create new records of this entity type. Returns false otherwise.
can_delete Returns true if the current user has permission to delete this record. Returns false otherwise.
can_read Returns true if the current user has permission to read this record. Returns false otherwise.
can_write Returns true if the current user has permission to update this record. Returns false otherwise.
rules_exist Returns true if the permission results represented by this object are the result of explicitly-defined permission rules. Returns false if they are the default results in the absence of explicitly-defined permissions.

Reflexive Relationship

Attempts to load reflexive (i.e. self-referential) relationships on entities are returned as objects with the following attributes.

Attribute Description
is_reflexive Returns true. Can be used to test if an object returned by a relationship is a reflexive relationship object.
referenced Returns an array of referenced entities for the given relationship.
referencing Returns a referencing entity for the given relationship. Returns null if no referencing entity exists. If the relationship is many-to-many (N:N), returns an array of referencing entities.

entitylist

The entitylist object is used within the Dynamics 365 entity tags. It provides access to all the attributes of a given entity list.

Attributes

Attribute Description
create_enabled Returns true if creation of new records is configured for the entity list. Returns false otherwise.
create_url Returns the configured URL path for a creation link/button for the entity list.
detail_enabled Returns true if a detail view for individual records is configured for the entity list. Returns false otherwise.
detail_id_parameter Returns the query string parameter name to use for the record ID when constructing a record detail view URL. See URL filters for details on using Liquid filters to construct URLs. e.g. id
detail_label Returns the configured localized label for detail view links/buttons for the entity list.
detail_url Returns the configured URL path for a detail view links/buttons for the entity list.
empty_list_text Returns the configured localized text to be displayed when the entity list view returns no results.
enable_entity_permissions Returns true if Entity Permission filtering is enabled for this entity list. Returns false otherwise.
entity_logical_name Returns the Dynamics 365 entity logical name for records to be displayed by this entity list. e.g. contact
filter_account_attribute_name Returns the attribute logical name for the lookup to account that will be used to filter result records by the current portal user's parent account. e.g. accountid
filter_apply_label Returns the configured localized label to be used for the link/button that applies an advanced attribute filter to the entity list results.
filter_definition Returns the JSON attribute filter definition for the entity list. See Entity List filters for details on how to use the metafilters Liquid filter to process this definition.
filter_enabled Returns true if advanced attribute filtering is enabled for the entity list. Returns false otherwise.
filter_portal_user_attribute_name Returns the attribute logical name for the lookup to contact that will be used to filter result records by current portal user's contact. e.g. contactid
filter_website_attribute_name Returns the attribute logical name for the lookup to adx_website that will be used to filter result records by the current portal website. e.g. adx_websiteid
language_code Returns the Dynamics 365 integer language code that will be used to select all localized labels for this entity list.
page_size Returns the configured result page size for the entity list.
primary_key_name Returns the primary key attribute logical name for records to be displayed by this entity list.
search_enabled Returns true if search is enabled for this entity list. Returns false otherwise.
search_placeholder Returns the configured localized text for the entity list search field placeholder.
search_tooltip Returns the configured localized text for the entity list search tooltip.
views Returns the available views for the entity list, as entity list view objects.
[attribute logical name] You can access any attribute of the entity list (adx_entitylist) Dynamics 365 record by logical name, in the same manner as an entities. e.g. {{ entitylist.adx_name }}

Entity List View Attributes

Attribute Description
columns Returns the columns of the view, as entity list view column objects.
entity_logical_name Returns the Dynamics 365 entity logical name for the records included in the view. e.g. contact
Id Returns the GUID ID of the view.
language_code Returns the Dynamics 365 integer language code that will be used to select all localized labels (column headers, etc.) for the view.
Name Returns the Dynamics 365 display name of the view.
primary_key_logical_name Returns the Dynamics 365 entity primary key logical name for the records included in the view. e.g. contactid
sort_expression Returns the default sort expression for the view. e.g. name ASC, createdon DESC

Entity List View Column Attributes

Attribute Description
attribute_type Returns the Dynamics 365 attribute type name for the column, as a string. e.g. Lookup, Picklist, String, Boolean, DateTime
logical_name Returns the Dynamics 365 attribute logical name for the column. e.g. createdon
Name Returns the localized Dynamics 365 display name for the column. e.g. Created On
sort_ascending Returns a sort expression string for sorting the column in ascending order. e.g. createdon ASC
sort_descending Returns a sort expression string for sorting the column in descending order. e.g. createdon DESC
sort_disabled Returns true if sorting is disabled for the column. Returns false otherwise.
sort_enabled Returns true if sorting is enabled for the column. Returns false otherwise.
width Returns the configured width for the column, in pixels.

entityview

The entityview object is used within the entityview tag, and provides access to the metadata for the view, as well as view result records.

Attributes

Attribute Description
columns Returns the columns in the view, as entitylist view column objects.
entity_permission_denied Returns true if access to view results was denied due to insufficient Entity Permissions for the current user. Returns false if read access to view results was granted.
entity_logical_name The Dynamics 365 entity logical name of the view result records. For example, contact
first_page The page number of the first page of view results. This will be 1 unless there were no results returned, in which case it will be null.
Id The GUID ID of the Dynamics 365 view that defines this entityview.
language_code The Dynamics 365 integer language code being used to load localized labels for the current view.
last_page The page number of the last page of view results. If there were no results returned, this will be null.
name The name of the Dynamics 365 view that defines this entityview., for example, Active Contacts.
next_page The page number of the next page of view results. If there is no next page of results, this will be null.
Page The page number of the current page of view results.
pages Returns an array of page numbers containing all pages of results for the current view.
page_size The number of results returned per page for the current view.
previous_page The page number of the next page of view results. If there is no previous page of results, this will be null.
primary_key_logical_name The Dynamics 365 logical name of the primary key attribute of the result entity for this view. For example, contactid.
records The current page of result records for the view, as entity objects.
sort_expression The default sort expression for the view. For example, nameASC, createdon DESC.
total_pages The total number of result pages for the view.
total_records The total number of results for the view (across all pages).

events

Provides the ability to access and render Events. The events object allows you to select a specific event, or all events.

events Object

The events object allows you to access any specific event in the portal, or to access all events in the portal (regardless of the event).

The events object has following attributes:

Attribute Description
occurences Returns a eventoccurancessobject containing all event occurrences in the portal
[event name or id] You can access any event by its Name or Id properties.
{% assign event = events["Event Name"] %}
{% assign event = events["da8b8a92-2ee6-476f-8a21-782b047ff460"] %}

event Object

The event object allows you to work with a single event, allowing you to access the schedules and occurrences for that event.

The event object has following attributes:

Attribute Description
occurences Returns a eventoccurrencesobject containing all occurrences for the event.
name The name of the event.
url The URL of the event.

eventoccurences Object

The eventoccurrences object allows you to access a collection of event occurrences objects. You can order the event occurrences and specify a date range for the occurrences to retrieve, and achieve pagination as well using liquid filters

{% assign occurances = event.occurrences.from[today].to[advance_date] %}

note that

{% assign occurances = event.occurrences.min[today].max[advance_date] %}

is also possible.

Following attributes are associated with eventoccurrences object

Attribute Description
All Returns all eventoccurance objects in the collection.

eventoccurence Object

Represents a single event occurrence. The associated attributes are given below:

Attribute Description
url The URL of the occurrence.
is_all_day_event Is this an all-day event?
start_time The start time for the event.
end_time The end time for the event.

forloop

Contains properties useful within a Iteration tags loop block.

Note

forloop can only be used within a Iteration tags tag.

Code

{% for child in page.children %}

{% if forloop.first %}

This is the first child page!

{% else %}

This is child page number {{ forloop.index }}.

{% endif %}

{% endfor %}

Output

This is the first child page!

This is child page number 2.

This is child page number 3.

Attributes

Attribute Description
first Returns true if it's the first iteration of the loop. Returns false if it's not the first iteration.
index The current item's position in the collection, where the first item has a position of 1.
index0 The current item's position in the collection, where the first item has a position of 0.
Last Returns true if it's the last iteration of the loop. Returns false if it's not the last iteration.
length Returns the number of iterations for the loop ߝ the number of items in the collection being iterated over.
rindex Number of items remaining in the loop (length - index) where 1 is the index of the last item.
rindex0 Number of items remaining in the loop (length - index) where 0 is the index of the last item.

forums

Provides the ability to access and render Forums and Forum Threads. Note that the ability to use liquid to render forum data extends to posts, but in order to create a new post of thread, you must use an ASP.NET web forms Page Template with said functionality built in (such as the default Forum Thread and Forum Post Page Templates).

The forums object allows you to select a Forum or Forum Threads :

<div class="content-panel panel panel-default">

<div class="panel-heading">

<h4>

<span class="fa fa-comments" aria-hidden="true"></span>

{{ snippets["Home Forum Activity Heading"] | default: "Forum Activity" | h }}

</h4>

</div>

{% for forum in website.forums %}

<ul class="list-group">

<li class="list-group-item">

<div class="row">

<div class="col-sm-6">

<h4 class="list-group-item-heading"><a href="{{ forum.url | h }}"> {{ forum.name | h }}</a></h4>

<div class="list-group-item-text content-metadata">{{ forum.adx_description | h }}</div>

</div>

<div class="col-sm-3 content-metadata">{{ forum.thread_count }} threads</div>

<div class="col-sm-3 content-metadata">{{ forum.post_count }} posts</div>

</div>

</li>

</ul>

{% endfor %}

</div>

forums Object

The forums object allows you to access any specific forum in the portal, or to access all forum threads in the portal (regardless of the forum).

The forum object allows you to work with a single forum, allowing you to access the threads for that forum.

The forumthreads object allows you to access a collection of forumthread objects. You can order the forum threads and achieve pagination as well by using liquid filters.

{% assign threads = forum.threads | order_by "adx_name", "desc" | paginate: 0,4 | all %}

A Single Forum Thread

The forumposts object allows you to access a collection of forumpost objects.

Attributes

Attribute Description
threads Returns a forumthreads object containing all forumthread objects in the portal.
All Returns all forum objects in the portal. Note that website.forums Is also an equivalent.
thread_count Returns the integer value of the count of how many threads there are in the entire website.
post_count Returns the integer value of the total number of posts in the portal.
[forum name or id] You can access any forum by its Name or Id properties.
`{% assign forum = forums["Forum Name"] %}
{% assign forum = forums["da8b8a92-2ee6-476f-8a21-782b047ff460"] %}

forum Object

Attributes

Attribute Description
threads Returns a forumthreads object containing all forum threads for the forum.
Name The Name of the Forum.
thread_count Returns the integer value of the count of how many threads there are in the forum.
post_count Returns the integer value of the count of how many posts there are in the entire forum.

forumthreads Object

Attributes

Attribute Description
All Returns all forumthread objects in the collection.

forumthread Object

Attributes

Attribute Description
posts Returns a forumposts object containing all forum posts for the thread.
author Returns the author for the thread (which is simply a contact entity object).
latest_post Returns the latest post in the thread.
first_post Returns the first post in the thread.
post_count Returns the integer value of the count of how many posts there are in the thread.
is_answered Is the thread answered or not?
is_sticky Is the thread a sticky thread?

forumposts Object

Attributes

Attribute Description
All Returns all forumthread objects in the collection.

A Single Forum Post

Attributes

Attribute Description
author Returns the author for the post (which is simply a contact entity object).
content The content of the post.
is_answer Is this post an answer to the thread?

knowledge

Provides access to Dynamics 365 knowledgearticle and category entity records to render articles and categories in a portal.

Attributes

Attribute Description
articles Returns an articles object containing article objects for the knowledgearticle entity records available in the portal.
categories Returns a categories object containing category objects for the category entity records available in the portal.

articles object

The articles object allows you to access a collection of article objects. You can order the articles and achieve pagination as well using liquid filters.

{% assign count = count | default: 3 %}
{% assign languagecode = website.selected_language.code %}
{% assign popular_articles = knowledge.articles | popular: count,languagecode  %}
{% if popular_articles %}
    <div class="list-group">
    {% for article in popular_articles %}
      <div class="list-group-item clearfix">
        <a class="title" href="{{ article.url | escape }}">{{ article.title | escape }}</a>
        <p class="description">{{ article.description | escape }}</p>
      </div>
    {% endfor %}
    </div>
{% endif %}

Attributes

Attribute Description
popular Returns a collection of article objects containing the most views. {% assign popular_articles = knowledge.articles.popular %}
recent Returns a collection of article objects containing the latest modified date. {% assign recent_articles = knowledge.articles.recent %}
top Returns a collection of article objects containing the highest rating. {% assign top_articles = knowledge.articles.top %}

Filters

The following filters can accept optional parameters for page size and language. First parameter is the number or records to retrieve. The default page size is 5. The second parameter is the code of a language to retrieve articles for a given language. Filters may be combined with other Liquid filters.

{% assign page_size = 5 %}
{% assign language_code = website.selected_language.code %}
{% assign recent_articles = knowledge.articles | recent: page_size, language_code %}
Attribute Description
popular Returns a collection of article objects containing the most views. {% assign popular_articles = knowledge.articles \| popular: 10, en-US %}
recent Returns a collection of article objects containing the latest modified date. {% assign recent_articles = knowledge.articles \| recent: 5 %}
top Returns a collection of article objects containing the highest rating. {% assign top_articles = knowledge.articles \| top: 3, en-US %}

categories object

The categories object allows you to access a collection of category objects. You can order the categories and achieve pagination as well using liquid filters.

{% assign category_url = sitemarkers['Category'].url %}
  {% assign count = count | default: 0 %}  
  {% assign categories = knowledge.categories | top_level: count %}
  {% if categories %}
    <div class="list-group unstyled">
    {% for category in categories %}
      <a href="{{ category_url | add_query: 'id', category.categorynumber }}" class="list-group-item">
        {{ category.title }}
      </a>
    {% endfor %}
    </div>
  {% endif %}

Attributes

Attribute Description
recent Returns a collection of category objects containing the latest modified date.
top_level Returns a collection of category objects that do not have a parent category.

Filters

The following filters can accept an optional parameter indicating the page size. The default page size is 5. Filters may be combined with other Liquid filters.

{% assign page_size = 5 %}
{% assign recent_categories = knowledge.categories | recent: page_size %}
Attribute Description
recent Returns a collection of category objects containing the latest modified date. You can provide parameters {% assign recent_categories = knowledge.categories \| recent: 10 %}
top_level Returns a collection of category objects that do not have a parent category. {% assign root_categories = knowledge.categories \| top_level %}

article Object

The article object allows you to work with a single knowledgearticle to display details of that article in the portal.

Attributes

article is an entity object, with all of the same attributes, in addition to those listed below.

Attribute Description
article_public_number The Article Public Number of the article.
comment_count The integer value of the count of how many comments there are for a given article.
content The content of the article.
current_user_can_comment Returns a Boolean value indicating whether or not the current user can add comments on the article.
is_rating_enabled Returns a boolean value indicating whether rating on an article is enabled.
keywords The keywords on the article.
name An alternate alias for the title of the article.
rating The decimal rating value on the article.
title The title of the article.
view_count The integer value of the number of times the article has been viewed.

category Object

The category object allows you to work with a single category to display its details in the portal.

Attributes

category is an entity object, with all of the same attributes, in addition to those listed below.

Attribute Description
categorynumber The Category Number of the category.
name An alternate alias for the title of the category.
title The title of the category.

page

Refers to the current portal request page. This object combines the attributes of the sitemap and the current request entities (usually a webpage).

The page object provides access to things like the breadcrumbs for the current page, the title or URL of the current page, and any other attributes or related entities of the underlying Dynamics 365 record.

<ul class="breadcrumb">

{% for crumb in page.breadcrumbs %}

<li><a href="{{ crumb.url | escape }}">{{ crumb.title | escape }}</a></li>

{% endfor %}

<li class="active">{{ page.title | escape }}</li>

</ul>

<div class="page-header">

<h1>{{ page.title | escape }}</h1>

</div>

<div class="page-copy">

{{ page.adx_copy }}

</div>

<div class="list-group">

{% for child in page.children %}

<a class="list-group-item" href="{{ child.url | escape }}">

{{ child.title | escape }}

</a>

{% endfor %}

</div>

<!-- Page {{ page.id }} was last modified on {{ page.modifiedon }}. -->

Page attributes

Attribute Description
breadcrumbs Returns the breadcrumb site map node objects for the page, starting from the site map root node and ending at parent.
children Returns the child site map node objects of the page.
parent Returns the parent site map node of the page. If the page is the Home page, parent will be null.
title The title of the page.
url The URL of the page.
[attribute or relationship name] You can access any attribute of the page's underlying Dynamics 365 record by logical name.
{{ page.createdon }}
{% assign attribute_name = 'name' %}
{{ page[attribute_name] }}
The values of most entity attributes map directly to Liquid types: Two Option fields map to Booleans, text fields to strings, numeric/currency fields to numbers, date/time fields to date objects. But, some attribute types are returned as objects:
  • Lookup (Entity Reference) fields are returned as entities.
  • Option Set/Picklist fields are returned as entities.
  • You can also load any related entities by relationship schema name.
    {{ page.adx_webpage_entitylist.adx_name }}
    In the case that a relationship is reflexive (that is, self-referential), a entities object will be returned. (Otherwise, the desired result would be ambiguous.){{ page.adx_webpage_webpage.referencing.adx_name }}
    Note: Loading large numbers of related entities, or accessing large numbers of relationships in a single template, can have a negative impact on template rendering performance. Avoid loading related entities for each item in an array, within a loop. Where possible, prefer use of the Dynamics 365 entity tags to load collections of entities.

polls

Provides the ability to access and render a poll.

The polls object allows you to select a specific poll or poll placement:

<div>

{% assign poll = polls["Poll Name"] %}

<h4>{{ poll.question }}</h4>

{% for option in poll.options %}

<div>

<input type="radio" name="{{ poll.name }}" id="{{ option.id }}" />

<label for="{{ option.id }}">{{ option.answer }}</label>

</div>

{% endfor %}

<button type="button">{{ poll.submit_button_label }}</button>

</div>

Polls Attributes

Attribute Description
placements Returns the pollplacements object.
[poll name or id] You can access any poll by its Name or Id properties. {% assign poll = polls["Poll Name"] %}
{% assign poll = polls["41827a5c-33de-49b8-a0c7-439e6a02eb98"] %}

Poll Placements Attributes

Attribute Description
[poll placement name or id] You can access any poll placement by its Name or Id properties.{% assign placement = polls.placements["Placement Name or Id"] %}
{% assign placement = polls.placements["7677c5d4-406e-4b6c-907c-916ac17dba0f"] %}

Poll Placement Attributes

Attribute Description
Name Returns the Name field for the poll placement.
placement_url The URL that can be used to retrieve the poll placement fully rendered by a template.
polls Returns the collection of poll objects associated with the placement. Iteration tags and Array filters may be used with this collection.
random_url The URL that can be used to retrieve a random poll from the placement fully rendered by a template.
submit_url The URL to which a completed poll is submitted.

Poll Attributes

Attribute Description
has_user_voted Returns true if the current user (logged in or anonymous) has already voted in this poll.
Name Returns the Name field for the poll.
options Returns the collection of poll option objects associated with the poll. Iteration tags and entities may be used with this collection.
poll_url The URL that can be used to retrieve the poll fully rendered by a template.
question Returns the Question field for the poll.
submit_button_label Returns a string that can be used to override the submit button label for the poll.
submit_url The URL to which a completed poll is submitted.
user_selected_option Returns the polloption object selected by the user (if they have already voted).
votes Returns the number of votes that have been tabulated for the poll.

Poll Option Attributes

Attribute Description
answer Returns the Answer field for the poll.
percentage Returns the percentage of votes in the poll for the option as a decimal number between 0 and 100.
votes Returns the number of votes that have been tabulated for the option.

request

Contains information about the current HTTP request.

{% assign id = request.params['id'] %}

<a href="{{ request.url | add_query: 'foo', 1 }}">Link</a>
Note

You can build URLs dynamically in Liquid using URL Filters.

Attributes

Attribute Description
params Named parameter values for the current request. params is a combination of URL query string parameters, form post parameters, and cookies.
Path The path of the current request URL.
/profile/
path_and_query The path and query of the current request URL.
/profile/?foo=1&bar=something
query The query part of the current request URL.
?foo=1&bar=something
url The full URL of the current request.
http://www.example.com/profile/?foo=1&bar=something

searchindex

The searchindex object is used within the Dynamics 365 entity tags, and provides access to the results of a query.

{% searchindex query: 'support', page: params.page, page_size: 10 %}

{% if searchindex.results.size > 0 %}

<p>Found about {{ searchindex.approximate_total_hits }} matches:</p>

<ul>

{% for result in searchindex.results %}

<li>

<h3><a href="{{ result.url | escape }}">{{ result.title | escape }}</a></h3>

<p>{{ result.fragment }}</p>

</li>

{% endfor %}

</ul>

{% else %}

<p>Your query returned no results.</p>

{% endif %}

{% endsearchindex %}

Attributes

Attribute Description
approximate_total_hits Returns an approximate count of total hits matching the index query. Note that due to the way the search index works in regard to security filtering and other design factors, this number is only an approximation, and may not exactly match the total number of results available to the current user in some situations.
Page Returns the page number of the current query.
page_size Returns the maximum page size of the current query. Note that if you want the actual number of results returned for the current page (as this may be less than the specified maximum page size), use results.size.
results Returns the query result page, as search index result objects.

Search Index Results

Attribute Description
entity The underlying entities for the result.
fragment A relevant short text fragment for the result, with terms matching the specified query highlighted using the <em> HTML tag. Note that certain types of queries do not support highlighted fragments, such as fuzzy queries (~) and wildcard queries (*). This property will be null in those cases.
Id The Dynamics 365 entity ID of the underlying record for the result, as a string. e.g. 936DA01F-9ABD-4d9d-80C7-02AF85C822A8
logical_name The Dynamics 365 entity logical name of the underlying record for the result. e.g. adx_webpage
number The number of the result, across all result pages, starting from 1. For example, for the first result of the second page of results, with a page size of 10, this value will be 11.
score The Lucene score of the result, as a floating-point value. Results will be returned ordered by this value.
title The title of the result.
url The URL for the result. This will usually ߝ but not necessarily ߝ be an absolute path for the current application, rather than a full URL. For example: /articles/article1/

settings

Allows you to load any Configure site settings for portals by name. If a setting with the given name is not found, Liquid types will be returned.

Note

Settings are returned as Liquid types, but you can use Type filters to convert them to other types.

{{ settings["My Setting"] }}

{% assign search_enabled = settings["Search/Enabled"] | boolean %}

{% if search_enabled %}

Search is enabled.

{% endif %}

{% assign pagesize = settings['page size'] | integer | default: 10 %}

{% if pagesize > 10 %}

Page size is greater than 10.

{% endif %}

sitemap

Allows access to the portal site map.

<h1>{{ sitemap.root.title }}</h1>

<ul class="breadcrumb">

{% for crumb in sitemap.current.breadcrumbs %}

<li><a href="{{ crumb.title }}">{{ crumb.title }}</a></li>

{% endfor %}

<li class="active">{{ sitemap.current.title }}</li>

</ul>

{% for child in sitemap.current.children %}

<a href="{{ child.url }}">{{ child.title }}</a>

{% endfor %}

It's also possible to load a site map node by URL path:

{% assign node = sitemap["/content/page1/"] %}

{% if node %}

{% for child in node.children %}

<a href="{{ child.url }}">{{ child.title }}</a>

{% endfor %}

{% endif %}

Site Map Attributes

Attribute Description
Current Returns the site map node object for the current page.
Root Returns the site map node object for the root (home) page of the website.

Site Map Node Attributes

Attribute Description
Breadcrumbs Returns the breadcrumb site map node objects for the node, starting from the site map root node and ending at parent.
Children Returns the child site map node objects of the node.
Description The description/summary content for the node. (This field may contain HTML.)
Entity Returns the underlying entities of the node. If the node has no underlying entity, this value will be null.
is_sitemap_ancestor Returns true if the sitemap node is an ancestor of the current node, otherwise false. Added 7.0.0008
is_sitemap_current Returns true if the sitemap node is the current node, otherwise false. Added 7.0.0008
Parent Returns the parent site map node of the node. If the node is the root node, parent will be null.
Title The title of the node.
url The URL of the node.

sitemarkers

Allows you to load any site marker by name. If the sitemarker exists, a sitemarker object will be returned. If a sitemarker with the given name is not found, Liquid types will be returned.

{{ sitemarkers["Login"].url }}

{% assign my_sitemarker = sitemarkers["My Site Marker"] %}

{% if my_sitemarker %}

<a href="{{ my_sitemarker.url }}">{{ my_sitemarker.adx_name }}</a>

{% else %}

Site marker "My Site Marker" does not exist.

{% endif %}

Sitemarker Attributes

Attribute Description
url The URL of the sitemarker target.
[attribute logical name] You can access any attribute of the sitemarker target Dynamics 365 record by logical name. e.g. {{ sitemarker.adx_name }}

snippets

Allows you to load any content snippets by name. If a snippet with the given name is not found, Null will be returned.

{{ snippets["Header"] }}

{% assign footer = snippets["Footer"] %}

{% if footer %}

{{ footer }}

{% else %}

No footer snippet was found.

{% endif %}

tablerowloop

Contains properties useful within a Iteration tags loop block.

Note

tablerowloop can only be used within a Iteration tags tag.

Attributes

Attribute Description
Col Returns the index of the current row, starting at 1.
col0 Returns the index of the current row, starting at 0.
col_first Returns true if the current column is the first column in a row, returns false if it is not.
col_last Returns true if the current column is the last column in a row, returns false if it is not.
First Returns true if it's the first iteration of the loop. Returns false if it's not the first iteration.
Index The current item's position in the collection, where the first item has a position of 1.
index0 The current item's position in the collection, where the first item has a position of 0.
Last Returns true if it's the last iteration of the loop. Returns false if it's not the last iteration.
Length Returns the number of iterations for the loop ߝ the number of items in the collection being iterated over.
Rindex Number of items remaining in the loop (length - index) where 1 is the index of the last item.
rindex0 Number of items remaining in the loop (length - index) where 0 is the index of the last item.

user

Refers to the current portal user, allowing access to all attributes of the underlying Dynamics 365 contact record. If no user is signed in, this variable will be Liquid types.

user is an entities.

{% if user %}

Hello, {{ user.fullname }}!

{% else %}

Hello, anonymous user!

{% endif %}

Attributes

In addition to having all of the attributes of an entities, user has the following attributes.

Refers to the portal website, allowing access to all attributes of the Dynamics 365 Website (adx_website) record for the portal.

Code

{{ website.adx_name }} ({{ website.id }})

Output

Community Portal (936DA01F-9ABD-4d9d-80C7-02AF85C822A8)

website

Allows you to load any weblinks by name or ID.

If the web link set exists, a web link set object will be returned. If a web link set with the given name or ID is not found, Liquid types will be returned.

<!-- Load web link set by ID -->

{{ weblinks[page.adx_navigation.id].name }}

<!-- Load web link set by name -->

{% assign nav = weblinks["Primary Navigation"] %}

{% if nav %}

<h1>{{ nav.title | escape }}</h1>

<ul>

{% for link in nav.weblinks %}

<li>

<a href="{{ link.url | escape }}" title="{{ link.tooltip | escape }}">

{% if link.image %}

<img src="{{ link.image.url | escape }}" alt="{{ link.image.alternate_text | escape }}" />

{% endif %}

{{ link.name | escape }}

</a>

</li>

{% endfor %}

</ul>

{% endif %}
Attribute Description
Copy The HTML copy of the web link set.
Name The name of the web link set.
Title The title of the web link set.
Weblinks The array of web link objects associated with the web link set.
[attribute logical name] You can access any attribute of the web link set Dynamics 365 record by logical name. e.g. {{ weblinkset.createdon }}
Attribute Description
Description The HTML description of the web link.
display_image_only Boolean attribute indicating whether the web link should be displayed as an image only, with no link text.
display_page_child_links Boolean attribute indicating whether the web link should show links to the sitemap child pages of the linked page, as sub-links.
Image The web link image object for this link. This attribute will be null if no image is present.
is_external Boolean attribute indicating whether the target URL of the web link is to an external site (rather than to an internal portal page).
is_sitemap_ancestor Returns true if the weblink's URL references an ancestor of the current sitemap node, otherwise false. Added 7.0.0008
is_sitemap_current Returns true if the weblink's URL references the current sitemap node, otherwise false. Added 7.0.0008
Name The name/title of the web link.
Nofollow Boolean attribute indicating whether the web link should be marked as rel="nofollow".
open_in_new_window Boolean attribute indicating whether the web link should be opened in a new browser window/tab when clicked.
Tooltip Tooltip text for the web link.
url The URL of the web link.
Weblinks The array of child web link objects associated with the web link.
[attribute logical name] You can access any attribute of the web link Dynamics 365 record by logical name. e.g. {{ weblink.createdon }}
alternate_text Alternate text for the image.
Height Integer containing the specified height of the image. If no height value was provided, this attribute will be null.
url The URL of the image.
Width Integer containing the specified width of the image. If no width value was provided, this attribute will be null.

See also

Add dynamic content and create custom templates
Liquid types
Liquid Objects
Liquid Tags
Liquid Filters