Join fields in a table from 2 objects connected by Contatct_Record__c

  • 1
  • Question
  • Updated 1 month ago
  • Answered
  • (Edited)
I have the following:

How do I create a page with a table that has the "View_Member__c" field from Member_DNA__c object, the "View Closed CR__c field" from Contact_Record__c object from a certain user identified as "Completed_By_User__c" field in the CR_User_DNA__c object?

Photo of Bill Fox

Bill Fox

  • 7,994 Points 5k badge 2x thumb

Posted 1 month ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,426 Points 10k badge 2x thumb
Hi Bill,

It looks like your Contact_record_DNA__c object is a junction object between Member_DNA__c and Contact_Record__c, which gives you a many-to-many relationship between Member_DNA__c and Contact_Record__c. And, CR_User_DNA__c has a many-to-one relationship with Contact_Record__c.

As a starting point, if you were to set up a table to display these relationships, which object are you building the table on? It seems like Contact_Record_DNA__c might be a good choice because each row on that object will have one value for Member_DNA__c, and one value for Contact_Record__c (if I'm not misunderstanding this). Then, I think you could show the CR_USER_DNA__c records with a popup or drawer, if you can establish the right context. Or, you could set up a child relationship on the model, and display those child records in a template field. I've done this for the Account & Contact objects on on this page:

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="Account" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Account">
            <fields>
                <field id="RecordTypeId"/>
                <field id="Name"/>
                <field id="Contacts" type="childRelationship" limit="10">
                    <fields>
                        <field id="AccountId"/>
                        <field id="Name"/>
                    </fields>
                    <conditions/>
                </field>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Account" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-9K--285">
            <fields>
                <field id="Name" uniqueid="fi-9K--287"/>
                <field id="Contacts" type="CHILDREL" limit="100" uniqueid="fi-9K--288">
                    <label>Contacts</label>
                    <template>{{Name}}
</template>
                </field>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-9Ks-228"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of Bill Fox

Bill Fox

  • 7,994 Points 5k badge 2x thumb
Hell Mark,

I am trying to use the "CR__c" field in the "Contact_Record_DNA__c" object  to only select records from the "CR_User_DNA__c" object  where "Completed_By_User__c" field is equal to the running user.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,162 Points 10k badge 2x thumb
If I understand right, then I believe in your Contact_Record__c model, in the child relationship for CR_User_DNA__c, you can set up a condition where CR__c = the running user's ID. You should be able to find the Conditions section after clicking through the Contact_Record__c model > Fields > CR_User_DNA__c > Conditions