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 Apps / Querying multiple tabl...
Power Apps
Unanswered

Querying multiple tables in a powerapp component

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am working on a project in Microsoft Dynamics Sales. This project involves creating custom components (at this stage using powerapp component framework) that can be added on a form as well as custom entities that are related too that component. What I would like to do is open the Leads form and have a component that displays a summary of all visits (my custom entity) related to the lead.

I am at the stage where I have the component (following this tutorial https://docs.microsoft.com/en-us/power-apps/developer/component-framework/implementing-controls-using-typescript) and have designed the init function to generate the html in the container (i.e. Labels and input fields). However, I am unsure on how I am supposed to pass data into these fields whenever a lead form is opened.

The entities are related using a lookup, and this is working as it should and the visit is referenced to a lead using the leads leadid on a field called new_new_parent_leadid.

What I hope to see is something as shown below:

https://i.imgur.com/C5qdBbq.png

Where visit count would be a count of all of the related visit entities to the given lead, and last updated would be the "Date Created" of the latest visit.

However, I am yet to find any good documentation on how I might achieve this. I am aware that I could create a rollup field on the Leads table and reference it to the visits table, but I don't want to create an extra column if I can avoid it. I also need to program the custom component myself rather than trying to modify the form through the designer.

Is there a way that I can I can get the data of the given lead, retrieve the "visits" based on the current leadid, then display this information on a powerapp component added to the lead table? Or is there an alternative I should use instead of the powerapp component to make these custom components?

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Anonymous , 

     

    One way to solve this could be an embedded Canvas App which you show inside the Lead form.

     

    If you want to solve it using PCFs. you could use a dataset PCF. Then you place a subgrid on the Lead form, and attach your PCF to the sugrid. The platform would deliver all the "visits" inside the dataset. The problem with this approach: you get all the visit records, even if you need only some aggregates: the count and the last visit. Not sure if an aggregate fetchXml can be used for the view you attach as subgrid (and supported).

     

    There is also the PCF way where you use a field PCF (dummy) and use the webAPI feature, and make the aggreate fetchXml retrieve by yourself.

     

    Hope this helps

     

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!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard