Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Powerportal App

(0) ShareShare
ReportReport
Posted on by 5

Hello community,

I'm looking for a COMPLETE example to create a view with fetchXML.
There are "only" little snippets of example ... or I'm didnt the right search. Didnt found a complete example :-(


My construct is following:
- MainEntity named "project". Primary key is a projectnumber.
- Any project has orders (entity order, pk ordernumber) n orders :1 project
- Any order has jobs ( entity job, pk jobnumber) n jobs : 1 order
Three levels I would say.

Aditional there are entities, I named cataloques, which contain ressources.
- like cars. Any car can be related to a job, relation 1:n
- like places which are related to jobs, also 1:n
and some more ...

Now I want to create lists of projects.
- Click a project all related orders should appear with their data from cataloque-entities.

Same for orders with jobs.

And of course the other way from jobs showing related order and project.

After some days of reasearch, I'm able to fetch a single entity:
[Web Template]
{% fetchxml project_query %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="cre48_prject">
    <attribute name="cre48_projectnr" />
  </entity>
</fetch>
{% endfetchxml %}

<ol>
{% for result in project_query.results.entities %}
  <li>
    GUID: {{result.cre48_projectid}}<br>
    No. {{result.cre48_projectnr}}
  </li>
</ol>


Also filtering to a single project works fine i.e. project-no. 12345:
<filter type="and">
  <condition attribute="cre48_stprojectnr" operator="eq" value="12345" />
</filter>

And same works for list of orders and jobs.

Now, my important problem:
<link entity> fails, when I try to collect data from related entities. Neither cataloques nor parents or childs give results.
In some cases nothing will be found.
In some cases a liquid error appears: Liquid error: Exception has been thrown by the target of an invocation.

When project_query is extended with

<link-entity name="cre48_order" from="cre48_orderid" to="cre48_projectid" link-type="outer" alias="o">
  <attribute name="cre48_ordernr" />
</link>
{{result.['o.ordernr']}} is empty :-(
Is somewhere an information, which columns mean:
- from
- to

Or how to collect data from related entities as complete example with schema, entities and fetchXML.
Thanks for help,
Andkan
  • AndKan Profile Picture
    5 on at
    RE: Powerportal App

    Solution:

    Add a filter to limit number of results.

    Entity t_d_stamm has more then 40000 records.

    Attribute top="50" seems to be ignored and then of course it takes a lot of time and times out.

    Thanks all for your help.

    AndKan

  • AndKan Profile Picture
    5 on at
    RE: Powerportal App

    Solution:

    Add a filter to limit number of results.

    Entity t_d_stamm has more then 40000 records.

    Attribute top="50" seems to be ignored and then of course it takes a lot of time and times out.

    Thanks for your help

  • AndKan Profile Picture
    5 on at
    RE: Powerportal App

    Thanks seeing syntax error …

    I reduced web template down to:

    {% fetchxml standort_query %}
    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="cr847_t_d_stamm">
    <attribute name="cr847_l_nr" />
    <attribute name="cr847_ha_nr" />
    <attribute name="cr847_inbetriebnahme" />
    <link-entity name="cr847_t_k_ort2" to="cr847_t_k_id_ort2" from="cr847_t_k_ort2id" link-type="inner" alias="ort">
    <attribute name="cr847_vorort" />
    <attribute name="cr847_strasse" />
    </link-entity>
    </entity>
    </fetch>
    {% endfetchxml %}
    <b>Hallo</b>

    And no crash … Seems the output is my problem 

    Adding two lines:

    {% for result in standort_query.results.entities %}

    {% endfor %}
    ... it crashes again …
    Greetings,
    AndKan
    Little update: It depends on cr847_t_d_stamm … when it is removed and only cr847_t_k_ort2 is fetched, it works.
    Suggestion for permissions is checked, but I didnt found the right place yet ...
    Update2: Removing and adding Entity permissions makes no difference.
    Accessing with an entity list is no Problem - so permissions seem to be correct.
    But fetchXML didn't work … it crahes with:

    Server Error in '/' Application.


    Request timed out.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Request timed out.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Request timed out.]


  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: Powerportal App

    Hi, I am taking a look at your code here now, and a few things doesn't look right to me:

    --> {{result.['ort.strasse']}}

    your shouldn't have the dot first there, can you try {{result['ort.strasse']}}

    also for this one: {{result.cr847_l_nr}} what is nr filter? also there is no underline

    it might be something weird on the forum when copying the code, can you add a snapshot?

    also to test, reduce the items you are rendering and you might find exactly which one is causing issues

    if it still doesn't work, take a look at this video, it might give you the real exception

    www.youtube.com/watch

    ------------

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

    We highly recommend users to migrate to PowerUsers community for new Portal questions:

    powerusers.microsoft.com/.../PowerAppsPortals

  • AndKan Profile Picture
    5 on at
    RE: Powerportal App

    hanks for suggestions.

    In XrmTool fetchXML Builder it works fine now.
    It shows my results from more then one level of entities.

    But this by XrmTool created XML used in a WebTemplate crashed whole page. It takes a lot of time and ends with:

    fetch_5F00_error.png

    WebTemplate is:

    {% fetchxml standort_query %}
    <fetch top="10">
      <entity name="cr847_t_d_stamm">
        <attribute name="cr847_l_nr" />
        <attribute name="cr847_ha_nr" />
        <attribute name="cr847_inbetriebnahme" />
        <link-entity name="cr847_t_k_ort2" to="cr847_t_k_id_ort2" from="cr847_t_k_ort2id" link-type="inner" alias="ort">
          <attribute name="cr847_vorort" />
          <attribute name="cr847_strasse" />
        </link-entity>
      </entity>
    </fetch>
    {% endfetchxml %}
    <ol>
    {% for result in standort_query.results.entities %}
    <li>
    Leuchten-Nr. : {{result.cr847_l_nr}} <br>
    Vorort: {{result.['ort.vorort']}}<br>
    Straße: {{result.['ort.strasse']}}<br>
    Haus-Nr. : {{result.cr847_ha_nr}}<br>
    Inbetriebnahme : {{result.cr847_inbetriebnahme}} <br>
    </li>
    {% endfor %}
    </ol>
    Entity permissions are global and complete on both entities.
    Ty
    AndKan
  • Suggested answer
    Fubar Profile Picture
    2,752 on at
    RE: Powerportal App

    As suggested by others, use XRMToolBox to get your query correct then copy and paste it into liquid.

    Then look at the entities (including linked entities) in the query and make sure that you have established entity permissions to allow access by the Portal user (entity permission attached to web role that is attached to the Contact record) - if in doubt set the entity permissions to Global (but do fine tune them later as Global is not good practice)

  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: Powerportal App

    We highly recommend users to migrate to PowerUsers community for new Portal questions:

    powerusers.microsoft.com/.../PowerAppsPortals

    Hi

    Have you created Entity Permissions for both your main entity and linked-entity?

    you must create an Entity Permissions when retrieving data programmatically

    ------------

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

  • AndKan Profile Picture
    5 on at
    RE: Powerportal App

    Thank you for the link.

    After reading, I downloaded and installed XrmToolbox and FetchXMLBuilder.

    This is very helpfully, because I can select only 'no error' columns and it helps me to understand a little bit more.

    So it is easier learning by doing.

    But it dont explain the background to me.

    It looks like, there is a mistake in my relationships.

    Ty.

    AndKan

  • Suggested answer
    necsa Profile Picture
    3,455 on at
    RE: Powerportal App

    Hi AndKan,

    I hope following linkwill be helpful

    stoneridgesoftware.com/.../

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans