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 / 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

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

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 70 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard