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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / print a lookup column ...
Power Pages
Answered

print a lookup column with fetchxml

(0) ShareShare
ReportReport
Posted on by 25

I'm trying to print the id of a lookup table with fetchXML on my power pages, like:

 

{% fetchxml yyyy %}
<fetch version="1.0" mapping="logical" no-lock="false">

<entity name="contact">
<attribute name="fullname" />
<attribute name="cccc_lookupcolumn" />
</entity>
</fetch>

{% endfetchxml %}
 
{% for contact in yyyy.results.entities %}
          <p>
            Nome: {{ contact.fullname }} <br/>
            my lookup column: {{ contact.cccc_lookupcolumn}}
          </p>
        {% endfor %}
 
 
Result:
helio1981_1-1715857394385.png

 

 

 

in the XrmToolBox it works fine, as you can see below:

 

helio1981_0-1715856878405.png

 

 

I'm able to list in the power pages the lookup table it self with this fetchXML below normally

<fetch version="1.0" mapping="logical" no-lock="false">
 <entity name="cccc_myforeigntable">
<attribute name="cccc_anycolumn" />
</entity>
</fetch>

 

I've tried to link-entity, to try get the lookup table id as well, but without success

 

I've tried to add a child permission for contact table in Table Permissions without success

 

any ideas?

 

 

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,375 Super User 2025 Season 2 on at

    The Lookup field is returned as an Object - you need to reference the field in the object eg. add .id etc  {{ contact.cccc_lookupcolumn.id }}  or {{ contact.cccc_lookupcolumn['id']}}   {{ contact.cccc_lookupcolumn.name }}

  • Verified answer
    helio1981 Profile Picture
    25 on at

    Well I got this

     

    I "exploded" the item of foreach with json function, so I was able to see how the object properties were, as below:

     

    {{ contact | json }} 

     

    so I noticed that the attribute name I was looking for came with a underscore prefix, as below:

    {{ contact._cccc_anycolumn}} 

     

     

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard