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 / Filter lookup based on...
Power Pages
Answered

Filter lookup based on logged in user

(0) ShareShare
ReportReport
Posted on by

Hello All,

I need to filter a lookup present on the web form based on currently logged in user.

 

it is WEB FORM , and not entity form or entity list.

 

This form i am using to register a case.

 

 

Is there any possibility that my lookup should only show the associated records based on the power portal user.

Categories:
I have the same question (0)
  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @EmployeeOcta ,

     

    The easiest way of filtering lookup would be by applying proper entity permissions. You need to create entity permission and define based on which relationship users need to see those records. If for some reason this is not applicable for you can try to dynamically filter lookup (but you will need to render it as a dropdown) similarly to how I do it in my article. Just make sure that the values that you dynamically obtain/set in dropdown were present in the view - otherwise, you will receive an error.

  • EmployeeOcta Profile Picture
    on at

    Hello 

     

     

     

     

  • Verified answer
    OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @EmployeeOcta,

    It is quite easy to get logged user details - you have specific liquid tag user for that. All you need to do is save needed data from it into hidden inputs or directly to js variables to be able to use later (see below)

    {% if user and user.parentcustomerid %}
     <input type="hidden" id="user-contact-id" value="{{user.id}}" />
     <input type="hidden" id="user-contact-name" value="{{user.fullname}}" />
     <input type="hidden" id="user-account-id" value="{{user.parentcustomerid.id}}" />
     <input type="hidden" id="user-account-name" value="{{user.parentcustomerid.name}}" />
    {% endif %}
    
    <script>
     // get user id from hidden input
     var userIdFromInput = $("#user-contact-id").val();
    
     // directly save user id to variable
     var userIdDirect = "{{user.id}}";
    </script>

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
sannavajjala87 Profile Picture

sannavajjala87 38 Super User 2026 Season 1

#2
Valantis Profile Picture

Valantis 37

#3
11manish Profile Picture

11manish 22

Last 30 days Overall leaderboard