Exercise: Display a List of Accounts Using Liquid in Power Pages
Exercise: Display a List of Accounts Using Liquid in Power Pages
In this hands-on lab, you learn how to access Dataverse data using Liquid code.
The goal of this exercise is to:
You will create a page that lists active accounts and shows the total number of accounts.
Step 1: Open Power Pages Design Studio
Sign in to Power Pages and open the website you want to edit.
Step 2: Create the Suppliers Webpage
In the Pages workspace, select + Page, enter "Suppliers" as the page name, choose the blank template, and add the page.
Step 3: Add HTML and Liquid Code
On the Suppliers page, add a text component and replace its placeholder with the following HTML and Liquid:
{% entityview logical_name:'account', name:'Active Accounts' %}
<p>We have {{ entityview.total_records }} accounts.</p>
<ul>
{% for account in entityview.records -%}
<li>{{ account.name }}
{% if account.telephone1 %}
(<a href="tel:{{ account.telephone1 }}">{{ account.telephone1 }}</a>)
{% endif %}
</li>
{% endfor %}
</ul>
{% endentityview %}
Code Explanation
Step 4: Preview the Results
After syncing, preview the page in Design Studio and in a browser. Initially, you will see "We have 0 accounts." because no table permissions exist yet.
Step 5: Add Table Permissions
To allow account records to be displayed, add global read permissions for the Account table:
• Table: Account
• Access type: Global access
• Permission: Read
What You Learned
This exercise shows practical Liquid usage for listing active accounts securely.
Comments
Post a Comment