web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Dynamically show/ hide...
Power Pages
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)
  • RK2021 Profile Picture
    91 on at
    Hi - are you placing this code in the same field as on the tutorial, the XML filter?
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,425 Most Valuable Professional on at
    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
  • Suggested answer
    Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at
    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.
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Hammed Profile Picture

Hammed 22

#2
Lucas001 Profile Picture

Lucas001 21 Super User 2026 Season 1

#3
DP_Prabh Profile Picture

DP_Prabh 19

Last 30 days Overall leaderboard