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 / Liquid syntax not work...
Power Pages
Unanswered

Liquid syntax not working for dynamic GUID

(0) ShareShare
ReportReport
Posted on by 10

I'm trying to get details for the "Relationship Manager" from the systemuser table which is linked to the Account, which in turn, is linked to the logged in user (Logged in User -> Account -> Relationship Manager)

When I try to get the systemuser details for a specific id with the following code it works:

{% assign entity_logical_name = 'systemuser' %}
{% assign contact = entities[entity_logical_name]['01334e8c-6013-ed11-b83f-002248ae4598'] %}
{% if contact %}
{{ contact.fullname | escape }}
{% endif %}

The problem is that I need to get the id from the account entity linked to the logged in user.

 

So I wrote the following code:

{% if user %}
{% assign account = entities.account[user.parentcustomerid.Id] %}
{% if account %}
{% assign relate_id = account.relationshipmanager.Id%}
Print RM Id: '{{relate_id}}'
{% assign entity_logical_name = 'systemuser' %}
{% assign contact = entities[entity_logical_name][relate_id] %}
{% if contact %}
{{ contact.fullname | escape }}
{% endif %}
{% endif %}
{% endif %}
The line where I print the RM Id my output shows what I expect: the ID of the item. But using that dynamic relate_id doesn't work.
 
I have tried a few different syntax approaches - not of which worked:
{% assign contact = entities[entity_logical_name][relate_id] %}
{% assign contact = entities[entity_logical_name]['relate_id'] %}
{% assign contact = entities[entity_logical_name][{{relate_id}}] %}
{% assign contact = entities[entity_logical_name]['{{relate_id}}'] %}
{% assign contact = entities[entity_logical_name][account.relationshipmanager.Id] %}

Please help me figure out what I'm doing wrong.

Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,562 Super User 2026 Season 1 on at

    Hi @J45,

     

    the first syntax is correct to reference the variable in liquid.

    {% assign contact = entities[entity_logical_name][relate_id] %}

     

    Is there any error coming? 

    If possible use that variable and print it on your page inside a <p>-Tag and see what the error is.

    In some cases that helps.

     

  • J45 Profile Picture
    10 on at

    There are no errors that I can see. It's just blank.

    Here's the code:

    {% if user %}
    {% assign account = entities.account[user.parentcustomerid.Id] %}
    {% if account %}
    {% assign relate_id = account.cr91f_relationshipmanager.Id%}
    {% assign entity_logical_name = 'systemuser' %}
    {% assign contact = entities[entity_logical_name][relate_id] %}
    <p>{{contact}}</p>
    {% if contact %}
    {{ contact.fullname | escape }}
    {% endif %}
    {% endif %}
    {% endif %}
  • Lucas001 Profile Picture
    2,562 Super User 2026 Season 1 on at

    Hi @J45,

     

    as far as I know liquid is case sensitive. Could you try to change those two line:

    {% assign account = entities.account[user.parentcustomerid.Id] %} --> {% assign account = entities.account[user.parentcustomerid.id] %}
    
    <!-- And this one -->
    
    {% assign relate_id = account.cr91f_relationshipmanager.Id%} --> {% assign relate_id = account.cr91f_relationshipmanager.id%}
    
    
  • J45 Profile Picture
    10 on at

    Thanks for the help so far, but unfortunately, it's still not working. I'm going to try a few more variations and feedback if I find anything working.

  • J45 Profile Picture
    10 on at

    Ok here's an interesting development: It turns out that my first test (code below) didn't actually work.

     

    {% assign entity_logical_name = 'systemuser' %}
    {% assign contact = entities[entity_logical_name]['01334e8c-6013-ed11-b83f-002248ae4598'] %}
    {% if contact %}
    {{ contact.fullname | escape }}
    {% endif %}

    What is curious is that it "works" in the design view if I hardcode the id, but when I run the site, it doesn't actually work. Could this have anything to do with table permissions? If so, can you advise what permissions I should be looking at?

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
Valantis Profile Picture

Valantis 46

#2
11manish Profile Picture

11manish 46

Last 30 days Overall leaderboard