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 / How to get user's attr...
Power Pages
Answered

How to get user's attribute in portal

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

{{user.fullname}} 

only above function work for me so far; can I access other user's attributes in portal??

I defined a field named departments in contact, the portal will display the content based on this users department

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

    hi @Anonymous,

    Yes you can access other attributes of the user the same way as from any other entity (see entity liquid object docs). All you need to know is logic name of the field. For example: field with logic name firstname can be accessed like this user.firstname; field with logic name dwc_somedata can be accessed like this - user.dwc_somedata. 

    Please be aware that lookup field will be returned as Entity Reference object and optionsets will be returned as OptionSet object.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for reply

    but when I try the code

    {% assign current_user = entities['contact'][user.id] %}
    {{current_user.cr7cc_departments}}
    {% if current_user == null %}
    I am empty
    {%endif%}
     
    it returns the "I am empty"
  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @Anonymous,

    You don't need to retrieve user as a contact in a separate request. User object is a special one - it already contains attributes from contact record and additional details like roles (check out this docs for more info). You should be able to retrieve data from your custom field using just user.cr7cc_departments call.

  • Pbv Profile Picture
    10 on at

    Hi,

     

    I have the same problem but in my case I am looking for the email id of the user who currently logged in.

     

    When tried with user.internalemailaddress the result is empty.   Appreciate your reply.

     

    Thanks

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

    Hi @Pbv ,

    Portal users are contacts in CRM. So to get the contact email address you need to use emailaddress1 field.

  • Pbv Profile Picture
    10 on at

    @OOlashyn- Excellent that works perfectly.

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 61

#2
11manish Profile Picture

11manish 40

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 36 Most Valuable Professional

Last 30 days Overall leaderboard