Building Solid Liquid Skills - Portals Built-in "Entities" Object

WEBSITE / CONFIG

entities

Allows you to load any CDS record by ID. If the record exists, and access to it is allowed through entity permissions setup, an entity object will be returned. If an entity with the given ID is not found, null will be returned.

{% assign contact = entities[““contact“][request.params.contactid] %}
{{ contact["fullname"] }}

An entity object provides access to other attributes: Id, logical_name, Notes, permissions, url, [attribute or relationship name]:

  • Id: The Power Apps logical name of the entity.

  • logical_name: The Power Apps 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 Power Apps 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 Power Apps entity by logical name. {{ entity.createdon }}{% assign attribute_name = 'name' %}{{ entity[attribute_name] }}

Other observations:

Lookup: If an attribute is of type lookup Notes, permissions, url, and [attributes or relationship name] won’t be available.

Optionset: If an attribute is of type OptionSet, two other attributes are available (Label and Value). Label shows the text representation of the optionset, whereas value, the numeric representation.

Notes: Returns a notes collection of records associated with entity object. Two other attributes are available within each notes entity object: documentbody and url. documentbody stores the content of an attached document associated with the note. This must be used with caution as it can delay page loads.

permissions: The Entity Permissions object provides access to aggregated permission assertion results for an entity. Attributes within this object are : can_append, can_append_to, can_create, can_delete, can_read, can_write, rules_exist.