Skip to content
Rishan Solutions
Rishan Solutions
  • PowerApps
  • SharePoint online
    • Uncategorized
    • Uncategorized
  • PowerAutomate
Rishan Solutions
Latest Posts
  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025 June 24, 2025
  • Recursive Queries in T-SQL May 7, 2025
  • Generating Test Data with CROSS JOIN May 7, 2025
  • Working with Hierarchical Data May 7, 2025
  • Using TRY_CAST vs CAST May 7, 2025
  • Dynamic SQL Execution with sp_executesql May 7, 2025

Using Liquid debugging techniques

Posted on April 16, 2025April 16, 2025 by Rishan Solutions

Loading

Liquid is a popular template language used in Power Pages to dynamically render content, such as retrieving data from Dataverse, displaying user-specific information, and controlling content flow. Debugging Liquid templates can be challenging, especially when working with complex logic or interacting with various data sources. However, applying effective debugging techniques can help you identify and resolve issues in your templates more efficiently.

Here’s a comprehensive guide to help you debug Liquid templates in Power Pages:


1. Enable Debugging Mode

One of the first techniques to make debugging easier is enabling debugging mode within Power Pages. This can provide more detailed information on errors, which can assist in pinpointing issues related to Liquid tags, filters, or logic.

Steps:

  • Go to the Portal Management app in Power Platform.
  • Under the Site Settings, look for the Debug Mode option.
  • Enable Debug Mode and refresh the page. This will display additional debugging information, such as Liquid syntax errors, runtime errors, and variable values.

2. Use the {{ content }} Tag for Debugging

In Liquid, you can output variable content to the page to see its current value during runtime. This can help verify if the data being passed to the template is correct.

Example:

{% assign myVariable = "Test String" %}
{{ myVariable }}

This will output the value of myVariable to the page, allowing you to see if the variable contains what you expect.

You can use this method to inspect:

  • Variables: Ensure that variables are being assigned correctly.
  • Objects and Collections: Check whether objects like records or collections are being returned as expected.

Example for inspecting objects:

{% assign myRecord = entities['contact'] %}
{{ myRecord.name }}

3. Use {{ 'your_variable' | inspect }}

Liquid provides an inspect filter that can help you examine the structure and content of complex objects or arrays. This is especially useful when working with Dataverse data, collections, or nested objects.

Example:

{{ myRecord | inspect }}

The inspect filter will print out detailed information about the structure and values within myRecord. This helps identify any unexpected or missing data in the object.


4. Check for Errors with {% if errors %}

In complex templates, Liquid error messages may not always be obvious. You can check if there are any issues by testing for errors using the errors object, which may capture issues within your code or the data being passed.

Example:

{% if errors %}
<ul>
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}

This will print out any errors associated with the current page or context, making it easier to debug issues related to Liquid expressions or data.


5. Use Conditional Statements for Debugging

Sometimes, you may want to isolate specific conditions within your code. You can use if and else statements to narrow down where the problem might lie. This approach helps you identify which part of the code is causing issues.

Example:

{% if myVariable == "Test String" %}
<!-- Debug output when the condition is met -->
{{ myVariable }}
{% else %}
<!-- Debug output when the condition is not met -->
"Condition failed."
{% endif %}

This way, you can focus on verifying certain conditions step by step.


6. Log to a Custom Data Source

If debugging directly in the page is not ideal, you can consider creating a custom logging system. This could be done by writing log messages to a custom entity or external storage, such as a SharePoint list or an Azure SQL database.

Example:

{% assign logMessage = "Test log: " | append: myVariable %}
{% capture logEntry %}
{{ logMessage }}
{% endcapture %}
<!-- Store the logEntry into a custom entity, like using a Power Automate flow -->

You can configure Power Automate to capture the logs in an entity for further review. This method works well if you need to debug issues that might not immediately manifest on the portal interface.


7. Break Down Complex Logic into Smaller Pieces

When working with complex conditions or loops, it’s helpful to break down the logic into smaller parts to isolate the issue. For example, if you’re looping through a collection, print out the individual elements before performing complex operations on them.

Example:

{% assign contacts = entities['contact'] %}
{% for contact in contacts %}
<!-- Debug each contact in the loop -->
{{ contact.name }}
{% endfor %}

This makes it easier to spot any issues with the loop or collection handling.


8. Use the {{ page.metadata }} Tag for Metadata Debugging

Power Pages stores metadata for each page, such as page title, description, etc. If you suspect an issue related to page-specific data, you can use Liquid’s metadata object to view these details.

Example:

{{ page.metadata.title }}

This will print the title metadata of the page. This technique can be helpful when trying to diagnose issues related to page content or URL routing.


9. Enable Detailed Error Messages in Power Apps Portals (if applicable)

For detailed error messages in development environments, you can configure Power Apps Portals to show more detailed error output by changing the Error Handling settings.

  • Go to Portal Management and select Site Settings.
  • Look for Errors under the Error Handling section.
  • Enable or configure settings that will display error details directly on the page.

10. Review the Server Logs for More Information

In some cases, the issue may not be visible directly within the portal. Power Platform’s server logs can provide additional information on errors or problems with your Liquid code. You can access the logs through the Portal Management application or by configuring an integration with monitoring tools like Azure Application Insights.

Posted Under Power PagesDataverse debugging techniques Error Handling inspect filter Liquid debugging page metadata Power AUtomate Power Pages Power platform Powershell server logs template debugging Testing

Post navigation

Automated test data generation for portals
Solution Architecture Best Practices

Leave a Reply Cancel reply

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

Recent Posts

  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025
  • Recursive Queries in T-SQL
  • Generating Test Data with CROSS JOIN
  • Working with Hierarchical Data
  • Using TRY_CAST vs CAST

Recent Comments

  1. Michael Francis on Search , Filter and Lookup in power apps
  2. A WordPress Commenter on Hello world!

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • March 2024
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • January 2022

Categories

  • Active Directory
  • AI
  • AngularJS
  • Blockchain
  • Button
  • Buttons
  • Choice Column
  • Cloud
  • Cloud Computing
  • Data Science
  • Distribution List
  • DotNet
  • Dynamics365
  • Excel Desktop
  • Extended Reality (XR) – AR, VR, MR
  • Gallery
  • Icons
  • IoT
  • Java
  • Java Script
  • jQuery
  • Microsoft Teams
  • ML
  • MS Excel
  • MS Office 365
  • MS Word
  • Office 365
  • Outlook
  • PDF File
  • PNP PowerShell
  • Power BI
  • Power Pages
  • Power Platform
  • Power Virtual Agent
  • PowerApps
  • PowerAutomate
  • PowerPoint Desktop
  • PVA
  • Python
  • Quantum Computing
  • Radio button
  • ReactJS
  • Security Groups
  • SharePoint Document library
  • SharePoint online
  • SharePoint onpremise
  • SQL
  • SQL Server
  • Template
  • Uncategorized
  • Variable
  • Visio
  • Visual Studio code
  • Windows
© Rishan Solutions 2025 | Designed by PixaHive.com.
  • Rishan Solutions