Power Pages – Add Advanced Client-Side Functionality
Get link
Facebook
X
Pinterest
Email
Other Apps
Power Pages – Add Advanced Client-Side Functionality Exercise
Step-by-step lab to enable portals Web API, retrieve Dataverse data, and render it as a chart using an external library.
What Is Sample Data?
Sample data is a set of pre-built records that Microsoft provides to help you understand how data is structured and how features work inside Dataverse and Power Pages. It populates common tables with realistic content so you can quickly test functionality without creating all records manually.
When sample data is installed in a Dataverse database, it adds a variety of records across multiple standard tables which you can use for development, learning, or demos.
What Sample Records Are Included
The sample dataset adds records that help you experiment with core tables like:
Accounts - companies with names and revenue data
Contacts - people associated with accounts
Opportunities and related sales data
Products and price lists
Cases, activities, and support records
For example, once sample data is installed you can run a Web API query against the Accounts table - with names, number of employees, and revenue values already populated - which can be used to generate meaningful charts in your exercise.
How to Install Sample Data
You can install sample data from the Power Platform Admin Center if your environment has a Dataverse database:
Open the Power Platform Admin Center and select your environment.
Select Settings and Data Management > Sample data.
If not already installed, choose Install Sample Data and wait for it to finish.
Once installed, you will see sample records across standard tables - providing ready-made data to test Web API calls, charts, forms, lists, and more.
Why Use Sample Data for Your Exercise
Sample data saves time and ensures your exercises produce visible results:
Provides realistic account and contact records
Helps test Web API GET queries without creating dozens of records
Makes charts and lists meaningful rather than empty
Lets you explore relationships between tables
Useful for learning filters, views, and data-driven components
Step 1 - Enable Portals Web API Access
Before you can pull data using Web API, you must configure site settings and table permissions.
Create Site Settings
Sign in to the Power Pages maker portal.
Select your environment in the top right.
Click the ellipsis (…) and open the Power Pages Management App.
Go to Site Settings and create a new setting:
Name: Webapi/account/enabled
Website: (select your portal)
Value: true
Save the setting.
Create another setting:
Name: Webapi/account/fields
Website: (select your portal)
Value: name, numberofemployees, revenue (logic name of Dataverse table column)
Save & close.
These settings whitelist the Accounts table for Web API read operations and specify which fields are accessible.
Step 2 - Create Table Permissions
Table permissions determine who can use the Web API to read account records.
Return to the Power Pages maker and open Design Studio.
Go to the Security workspace → Table permissions.
Click + New permission and enter:
Name: Account
Table: Account (account)
Access type: Global
Permission to: Read
Click Add roles and include:
Anonymous Users
Authenticated Users
Select Save.
This allows both public and logged-in visitors to query account data via the Web API.
Step 3 - Test the Web API
Open a new browser tab and run the following URL (replace with your portal URL):
You should see a JSON response containing account data with fields you enabled.
Step 4 - Create a Content Page
Now you’ll add a new page where you’ll embed JavaScript to retrieve and transform Web API data.
Open Design Studio → Pages workspace.
Click + Page.
Enter Chart as the page name and include it in main navigation.
Select Start from blank layout and click Add.
Select Edit code for the new page.
Open the generated .customjs.js file in Visual Studio Code.
Step 5 - Add JavaScript to Retrieve Data
Insert the following script logic to fetch data and prepare it for plotting. This code retrieves account records using the Web API, transforms the results, and logs the output.
Save the file and sync changes so the site can load this script.
Then open the page in preview mode. And open developer tool and check the console. Verify that the console output contains the same data as previously retrieved, except that it's now showing as transformed.
The data structure is now prepared for plotting. Assign the appropriate labels to data points:
name - Company name x - Number of employees y - Company revenue in thousands z - Revenue for each employee (calculated)
Step 6 - Add External Chart Library
To visualize the transformed data, include Highcharts.js in your portal footer:
Comments
Post a Comment