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 / Unable to get Lookup f...
Power Pages
Answered

Unable to get Lookup fields, FetchXML Liquid error: Exception has been thrown by the target of an invocation.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to get some JSON data with FetchXML but running into an issue whenever I try to pull in data from lookup fields.

 

I have a location (cref9_location) that has a min and a max on the registration table (cref9_registration), and I want to list the min and max by location. It's an N:1 relationship (a registration can only be associated to one location, but one location can be associated to many registrations).

 

 

{% fetchxml feed %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
 <entity name="cref9_registration" >​
 <attribute name="cref9_totalmin" />
 <attribute name="cref9_totalmax" />
 <link-entity name="cref9_location" to="cref9_location" from="cref9_name">
 <attribute name="cref9_name" />
 </link-entity>
 </entity>
</fetch>
{% endfetchxml %}{
{% for item in feed.results.entities %}
 "{{ item.cref9_name }}": {"min": "{{ item.cref9_totalmin }}", "max": "{{ item.cref9_totalmax }}"}
 {% unless forloop.last %},{% endunless %}
{% endfor -%}}

 

 

I'm not 100% sure my link-entity is set up correctly: cref9_location is the name of the Table I'm targeting, and the column in cref9_registration with that lookup is also called cref9_location. cref9_name is in the cref9_location table. However, I've tried every imaginable combination of these values and I always get the error:

 

{ Liquid error: Exception has been thrown by the target of an invocation.}

 

The cref0_location table has Global permission set but I've also set it explicitly to all web roles. Just not sure what I'm doing wrong.

Categories:
I have the same question (0)
  • Verified answer
    ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @Anonymous 

     

    Probably you are missing intersect attribute in the link entity.  I am not sure how you generated your FetchXML. I would strongly suggest you try the awesome tool "Fetch XML Builder" 

     

    https://www.xrmtoolbox.com/plugins/Cinteros.Xrm.FetchXmlBuilder/ 

     

    You can use the XRM toolbox and install the Fetch XML Builder then add your entities and link to your other entities and get your FetchXML. There are some good videos out there on youtube. 

     

    Hint: Remember to set your Table permissions for all your entities 

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Valantis Profile Picture

Valantis 59

#2
11manish Profile Picture

11manish 51

#3
Haque Profile Picture

Haque 28

Last 30 days Overall leaderboard