Liquid “Object not found” error

Loading

The “Object not found” error in Power Pages (formerly Power Apps Portals) occurs when you’re using Liquid templates to fetch or display data, and the object you’re referencing either does not exist, is inaccessible, or fails due to security filtering like Entity Permissions.

This guide will explain the causes, walk you through common scenarios, and offer step-by-step troubleshooting to resolve the error.


Understanding the “Object not found” Error

Liquid is a server-side templating language used to retrieve and display data in Power Pages.

The error appears like this:

Liquid error: Object 'case' not found.

Or simply:

Object not found.

Common Causes

  1. Missing Record (Primary Key ID doesn’t exist)
  2. Incorrect Liquid Syntax
  3. Entity Permission not granted for the current user
  4. Wrong FetchXML or entity tag logic
  5. Incorrect table (entity) name or plural name
  6. Invalid or expired request.querystring or route values
  7. Liquid loops referencing an object outside scope

Example Situations

1. Referencing a Record That Doesn’t Exist

{% assign case = entities['incident']['0b12ac1e-23ab-44d2-91e3-xxxxxxx'] %}
{{ case.title }}

If the record with that GUID doesn’t exist, or the user can’t access it, you’ll get the object not found error.


2. Using Wrong Syntax or Misnamed Entity

liquidCopyEdit{% assign contact = entities.contact['id'] %}

If contact isn’t the right entity name or 'id' isn’t a valid key, the object fails.


Step-by-Step Troubleshooting

Step 1: Check if the Record Actually Exists

If you’re referencing a record via ID:

  • Go to Dataverse (or Portal Management App)
  • Search for the record
  • Verify it exists and is active

Step 2: Check Entity Name and Case Sensitivity

Liquid uses logical names of tables/entities:

Correct:

entities['incident']

Incorrect:

entities['Incident']

Entity names in Liquid are case-sensitive and must be schema names, not display names.


Step 3: Verify Entity Permissions

Even if the record exists, the portal may restrict access via Entity Permissions.

To check:

  1. Go to Portal Management App
  2. Navigate to Entity Permissions
  3. Ensure:
    • Permission is created on the correct table
    • It includes Read privilege
    • The permission is assigned to the right Web Role
    • The Portal User (Contact) has that role

Also confirm if the scope (e.g., Contact/Account) aligns with the user’s relationship to the data.


Step 4: Check Your Liquid Syntax

Bad Liquid syntax can cause object referencing failures.

Example of a working fetchxml block:

{% fetchxml open_cases %}
<fetch top="5">
<entity name="incident">
<attribute name="title" />
<filter>
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
{% endfetchxml %}

<ul>
{% for case in open_cases.results.entities %}
<li>{{ case.title }}</li>
{% endfor %}
</ul>

Incorrect:

  • {% for case in cases %} (if cases is undefined)
  • Using results wrong, like open_cases.entities instead of open_cases.results.entities

Step 5: Validate Route Values and Query Strings

If you use values like:

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

Make sure the URL includes ?id=<guid> or the id is passed via route mapping.

No value or an invalid one will break the record reference.


Step 6: Use Debug Output (Temporary)

For debugging, output key elements:

{{ request.params['id'] }}
{{ user.fullname }}
{{ user.id }}

Use {% if case != null %}...{% endif %} to safely check object existence before accessing properties.


Step 7: Clear Cache (After Permission Change)

Always clear portal cache if you’ve just added or modified:

  • Entity Permissions
  • Web Role assignments

Do this by visiting:

arduinoCopyEdithttps://yourportal.powerappsportals.com/_services/about

Click Clear Cache


Example Fix

Scenario:

You created a custom page to show support case details using a Liquid template like:

{% assign case = entities['incident'][request.params['id']] %}
<h2>{{ case.title }}</h2>

But users see:
“Object not found”

Resolution Steps:

  1. Verify the id query string is passed correctly:
    • https://yourportal.com/support-case?id=GUID
  2. Confirm the record exists in Dataverse
  3. Create Entity Permission on incident table:
    • Scope: Contact
    • Privileges: Read
    • Assign to a Web Role
  4. Assign the Web Role to the portal user (Contact)
  5. Clear cache
  6. Retest

Leave a Reply

Your email address will not be published. Required fields are marked *