Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

Getting started with liquid

(0) ShareShare
ReportReport
Posted on by 375

Hi 

I've built PowerApps for sometime and just started to venture into Power Pages. 

As a first step I'm trying to split out front desk (using Power Pages) and back office (using PowerApps), sharing a common Dataverse environment. (For the moment Power Pages will be used for 'lighter' applications and the heavy work to be done in PowerApps.)

 

Within PowerApps I can use the Office365Users connector to identify the user and use this to look up various user values e.g. Line Manager.

 

The Power Pages site will require all users to authenticate to access some areas. 

Importantly, I need to be able to retrieve the user details and then pass this to filters to extract information relevant to the user only.

I also need to be able to extract values from one table (say UID) and pass this to a field in another table.

 

From what I can find out it appears that Liquid will do what I need.

However, the information I've found so far is a bit like picking up a book with the first two chapters missing. 

The information on Microsoft learn is useful as long as you know where to put the liquid code in the first place.

 

For example, this snippet {{ page.title }} is supposed to display the page name on the page but where to you paste the code?

 

My initial (urgent) requirement is to:

1. Identify the logged in user (maybe use this in a welcome message e.g. Hi {{ user }}, welcome to the site) - this also confirms the user is identified.

2. Assuming that the user identity includes their email address, use this to match and pull their record from a Dataverse table.

3. Use the user UID from the Dataverse table and pass this as the foreign key to fields in other Dataverse tables.

 

I've probably missed the obvious but I doubt that I'm the only one figuring out the details.

 

Thanks in advance.

Categories:
  • Gary_Eden Profile Picture
    375 on at
    Re: Getting started with liquid

    Hi @ragavanrajan 

    Many thanks for your help so far - I can certainly recommend the XRMToolbox for creating the Fetch query.

    For anyone else finding this post there are a couple of additional final steps required to display the returned information from Fetch in the Power Pages page, as follows:

     

    Gary_Eden_1-1690473046192.png

     

    You then need to do something with the output/result.

    Gary_Eden_2-1690473425939.png

    In my above example only one result will be returned.

     

    (Apologies in advance.)
    There two final bits that are escaping me... I'm hoping these are possible.

    In the final part of my example above I'm passing the returned values to variables. 

     

    Is it possible to...

    A) Pass the variable e.g. {{ userEmail }} to be used within a list to filter it.
    I've tried using the value in the view filter but this returns nothing - adding the email directly produces the correct outcome.

    Gary_Eden_3-1690473773063.png

    B) Pre-populate form values with variables

    Gary_Eden_4-1690473872005.png

     

     

    Thanks in advance. 

     

     

     

     

     

     

     

     

     

  • Gary_Eden Profile Picture
    375 on at
    Re: Getting started with liquid

    Hi @ragavanrajan 

    My IT guys have approved the use of the XRMToobox so I'll be giving it a go - looks promising.

    In the meantime (if anyone else finds this post) I'd highly recommend the Microsoft Learn section on Liquid https://learn.microsoft.com/en-us/training/modules/power-pages-liquid/  

     

    Suggestion to Microsoft.
    Please can you make the link to the Power Pages training more obvious!

    Gary_Eden_0-1690360427765.png

    It would also help if there were direct links in the documentation to the relevant training module.

  • Verified answer
    ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Getting started with liquid

    Hi @Gary_Eden 

     

    Sure. The simple way is to use the fetchxml builder to build your query. 

     

    Can you try the FetchXML builder from the XRM toolbox? 

    https://www.xrmtoolbox.com/plugins/Cinteros.Xrm.FetchXmlBuilder/ 

     

    Try playing around with different combinations and see if that works for you. 

     

    Hope it helps.
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • Gary_Eden Profile Picture
    375 on at
    Re: Getting started with liquid

    Hi @ragavanrajan 

     

    I've managed to make some progress and I'm now able to pull the authenticated user information details from the Contacts table using 

    {{ user.emailaddress1 | escape }}
    Interestingly it refers to "user" not "contact" as the table source yet it pulls the information from "contact table" - I've tested this by amending the job title value.
    {{ user.jobtitle | escape }}
     
    What I'm trying to do now is use the value from {{ user.emailaddress1 | escape }} to pull out the uid from another table to use elsewhere. 
     
    In PowerApps you can use a simple LookUp for example:
    LookUp(
    myEmployees,
    employeeEmail= {{ user.emailaddress1 | escape }}
    ).uid
     
    Reading the information it looks like I need to combine Liquid and Fetch to achieve the equivalent result. Probably simple when you know how but it's evading me.
     
  • Gary_Eden Profile Picture
    375 on at
    Re: Getting started with liquid

    Hi @ragavanrajan 

    Thanks for your help.

    I'd found the links before but I was overthinking everything - I hadn't realised that Liquid is just a mark-up language. Reading your reply helped make the connection.

     

    So for anyone else finding this post, here's the Liquid example added to a text block on a page.

    Gary_Eden_0-1690188166886.png

    And this is what is displayed when previewed (I'm running unauthenticated at the moment).

    Gary_Eden_1-1690188214801.png

    Now to have some fun.

      

  • Verified answer
    ragavanrajan Profile Picture
    7,036 Most Valuable Professional on at
    Re: Getting started with liquid

    Hi @Gary_Eden 

     

    Welcome to the power pages forum. Your understanding is right. Power Pages will work based on authenticated users. There are different types of logins used in Power Pages. 

    1. Local Authentication ( will be deprecated. Link here

    2. Azure AD (Link here)

    3. Azure AD B2C (Link here

     

    Note: Recommended authentication is Azure AD B2C but you can do Azure AD also. 

     

    Once the user is logged in to the Power Pages site. Then you can use the liquid object to display the welcome message. 

     

    Example here:

     

    {% if user %}
     
    Hello, {{ user.fullname | escape }}!
     
    {% else %}
     
    Hello, anonymous user!
     
    {% endif %}

     

    More details here 

     

    For Q2: All user details are stored in the "Contacts" Table by default. So you can utilise this table and fetch email addresses and all other relevant details ( This is applicable once the user is authenticated). Power Pages will create a contact in the contacts table once the authentication is successful.  

     

    For Q3: Related to the Q2 answer. You can use a unique GUID or set any other fields as per your requirement. 

     

    Most important: To make liquid work, You should set appropriate table permissions to the contacts and web roles too. Link here

     

    Have fun. Hope the above info gives you some idea to get started. 

     

    Hope it helps.
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43