web
You’re offline. This is a read only version of the page.
close
Skip to main content
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:
I have the same question (0)
  • Suggested answer
    Fubar Profile Picture
    8,112 Super User 2025 Season 2 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,347 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
    87 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Pages

#1
Jon Unzueta Profile Picture

Jon Unzueta 100 Super User 2025 Season 2

#2
Shafiuddin Profile Picture

Shafiuddin 45

#3
Fubar Profile Picture

Fubar 36 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics