How could I show records with its most recent creadtedly child record in a table together

pocpoc Member
edited February 2019 in Questions
Is there any way to show the Most recently created child record with its parent record together.
I'm not able to retrieve the children information If I use the Parent as the table model.
However, if I use the child model for this table. Although I can lookup back to its parent record. But in this table, I have no way to filtered out the most recent child record.
Any idea to achieve this?



  • JerryJerry Member
    edited November 2017
    Off the top of my head I'd say use two models. An aggregate model of the children grouped by parent and ordered by created date, and then another model of the children with all details where their Id is present in the aggregate model
  • Chandra VChandra V Member
    edited February 2019
    Here's how you can do it:

    1. Create a model for your parent
    2. In the field picker, select "Child Relationships".  Find your child object and select it.
    3. Your child object will now show up in your field list (on the model).  Click it - then you can set some properties.
    4. Select "CreatedDate" on your child object. We'll use this to get the most recently created child.  Select any other fields you want to show (looks like you want to show ChildStatus, so select that.)
    5.  While clicked on the Child fields, select Properties.  Set the record limit to 1 (so you only get one record) and the Ordered By field to CreatedDate DESC so you get the one most recently created.

    6.  Now create your table based on your Parent model.  From the model tree up top, drag that child relationship field to your table.  then you display fields using the Template merge syntax.

    I build an example page using Accounts as the parent, and Contacts as the child.  So this table shows the most recently created Contact.

    Here's the xml so you can see how I did it:

    <skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
            <model id="accounts" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Account">
                    <field id="Name"/>
                    <field id="Id"/>
                    <field id="Contacts" type="childRelationship" limit="1" orderby="CreatedDate DESC">
                            <field id="CreatedDate"/>
                            <field id="Name"/>
            <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="accounts" buttonposition="" mode="read" allowcolumnreordering="true" uniqueid="sk-3q_Qo2-128">
                    <field id="Name" hideable="true" uniqueid="fi-3q_Shg-141"/>
                    <field id="Contacts" type="CHILDREL" limit="100" hideable="true" uniqueid="fi-3q_Vxm-150" valuehalign="">
                    <action type="edit"/>
                    <action type="delete"/>
                <massactions usefirstitemasdefault="true">
                    <action type="massupdate"/>
                    <action type="massdelete"/>
                    <view type="standard"/>
            <styleitem type="background" bgtype="none"/>

  • pocpoc Member
    edited July 2017
    Appreciate your helpful answer.
    One more question, it seems your solution only works for 1 child record.
    Is it possible to make it work for multiple children records as the below image?
    Thanks so much.

  • edited July 2017

    Is there a requirement to show the Child records in 2 columns?  The easiest approach is to show 2 records in the same Child record column.  Just change the record limit from 1 to 2.  You can add the date field to differentiate the entries.

    If you must show the child records in 2 columns, you'll need a custom render for the second column.


  • pocpoc Member
    edited July 2017
    Any example or documentation can refer to the custom render you mentioned? Thanks
Sign In or Register to comment.