Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Suggested answer

Dynamically show/ hide buttons on entity list grid in Power Pages portals based on logged in user

(1) ShareShare
ReportReport
Posted on by 1
 

I'm trying to filter a Power Pages (Power Apps Portal) entity list by the currently logged-in user. Hardcoded fetch XML works, but when I switch to a dynamic approach with Liquid, it fails to filter.

For example, the following hardcoded fetch works fine:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="request_ticketlist">
<filter type="and">
<condition attribute="ticket_createdby" operator="eq" uiname="John" uitype="contact" value="{3AAAAA7C-BD8B-EF21-AC21-000D3DDA56F5}" />
</filter>
</entity>
</fetch>

 

However, when I try referencing the current user’s GUID, it doesn’t work. For example:
 
{% if user and user.contactid %}
{% assign currentUserId = '{' | append: user.contactid | append: '}' %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="request_ticketlist">
    <filter type="and">
      <condition attribute="ticket_createdby" operator="eq" value="{{ currentUserId }}" />
    </filter>
  </entity>
</fetch>
{% endif %}
 
 
I’ve confirmed the table permissions for “request_ticketlist” and “ticket_createdby” are correct, and the user is signed in.
 
Things I’ve tried:
  1. Using {{ user.contactid }} directly without braces.
  2. Checking entity permissions for the contact and request_ticketlist tables.
  3. Verifying sign-in and verifying that “user” data is available in the same block.
Question:
How can I ensure that my fetch XML dynamically filters records based on the signed-in user’s contact ID? Any configuration steps I might be missing?
 
 
Thank you!
Categories:
  • Suggested answer
    Fubar Profile Picture
    7,821 Super User 2025 Season 1 on at
    Dynamically show/ hide buttons on entity list grid in Power Pages portals based on logged in user
    As per the first response, please specify where you are trying to use the code.  If it is in the Filter Criteria field in the screen shot in the link you provided, that field will only accept a hardcoded fetchxml condition - it will not perform additional Liquid commands.
     
    As per Oliver's response, the options for the List are sensitive to the users table permissions so having the correct Scope (Contact, Account, Parent, Global) for permissions may be what you need e.g. if the user doesn't have edit permission on the target the edit option will not show, so having a Lookup on the target record set to the portal users Contact record and a Table Permission (for the target table) with Scope = Contact would probably work.
     
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,248 Most Valuable Professional on at
    Dynamically show/ hide buttons on entity list grid in Power Pages portals based on logged in user
    Hi, first thing here I would check your table permissions, doesn't it make sense to only allow users to see their own tickets?
     
    If that's what you are trying to achieve, you can define that at the permission level instead of the fetchxml level, this will ensure your data is proteceted
     
    if you still need the permissions to be global for some reason, try using {{ user.id }} to retrieve the user id
  • RK2021 Profile Picture
    74 on at
    Dynamically show/ hide buttons on entity list grid in Power Pages portals based on logged in user
    Hi - are you placing this code in the same field as on the tutorial, the XML filter?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,522 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,890 Most Valuable Professional

Leaderboard

Featured topics