cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexiscool3104
Frequent Visitor

Display first child record in parent form

I have a parent table and a child table. Each parent can have many children, each child can have a single parent through lookup.

Parent:

alexiscool3104_0-1664409060808.png

Child:

alexiscool3104_1-1664409147870.png

 

I would like for the parent form to display the parent fields and also a single (perhaps the latest) child's fields, like so... (only in forms in a MDA, not in dataverse)

alexiscool3104_3-1664409558053.png

 

I could clunkily do this through power automate and some extra fields in the parent record but I'd prefer to do this using datatverse and forms if possible. Is there any way I can do this? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
dpoggemann
Super User
Super User

Hi @alexiscool3104 ,

 

I would follow a similar approach Microsoft utilizes with Accounts --> Contacts where there is a "Primary Contact" field identified as a lookup on the Parent Account table.  If that is setup then you can utilize a "Quick View" form for the child table that would be displayed on the parent form.

 

To accomplish this you could to the following type of code in a Real Time Workflow:

  1. Trigger:  On create of the child record or change of the Parent field on the child record do the following..
  2. If (creation date of current parent.primary_child < currentrecord.creation date) or whatever rule you need to do
    1. Set parent record's primary child lookup field to the current record

You will have to work through the rules for setting this record but the nice thing is that you can do this when you either create or update the child records.

 

Note:  If you change the child to point to a different parent then that will not be handled well with this logic because nothing will change the primary child on the old parent record if this was the primary....  I have done this in other ways like not let them change the parent after it has been set (make it read only on forms etc.).

 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

View solution in original post

2 REPLIES 2
dpoggemann
Super User
Super User

Hi @alexiscool3104 ,

 

I would follow a similar approach Microsoft utilizes with Accounts --> Contacts where there is a "Primary Contact" field identified as a lookup on the Parent Account table.  If that is setup then you can utilize a "Quick View" form for the child table that would be displayed on the parent form.

 

To accomplish this you could to the following type of code in a Real Time Workflow:

  1. Trigger:  On create of the child record or change of the Parent field on the child record do the following..
  2. If (creation date of current parent.primary_child < currentrecord.creation date) or whatever rule you need to do
    1. Set parent record's primary child lookup field to the current record

You will have to work through the rules for setting this record but the nice thing is that you can do this when you either create or update the child records.

 

Note:  If you change the child to point to a different parent then that will not be handled well with this logic because nothing will change the primary child on the old parent record if this was the primary....  I have done this in other ways like not let them change the parent after it has been set (make it read only on forms etc.).

 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
alexiscool3104
Frequent Visitor

Thanks Drew 🙂

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (4,447)