In content Document

  • 1
  • Question
  • Updated 2 months ago
I have used "In Content Document (with Record Context) to upload documents.  I can see the uploaded documents in "ContentDocument" object.  But I see no common Id to link my object "CR_File_DNA__c" to the "ContentDocument"

https://drive.google.com/file/d/1anElTQ8CKuymAIC0NxCB7NwqCoKSyVGB/view
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb

Posted 2 months ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Bill, I believe you can use the ContentDocumentLink object to grab the links between objects and documents. Read more here:

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_...

"Represents the link between a Salesforce CRM Content document or Salesforce file and where it's shared."
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
I should expand on this answer, since it's a tricky setup. The ContentDocumentLink object is a junction object that connects documents with whatever records or entities you want. This would be accessed via an additional model on your Skuid page. Here's an overview from our documentation:
"To view files uploaded to the ContentDocument object, you’ll need a Skuid model for the ContentDocumentLink object. This is the likely scenario for files uploaded through the File Upload component using the File Storage Location property set to the In Content Document (with Record Context) value.

A Skuid model query on the ContentDocument object does not return the expected results due to the specialized configuration of the object.

To view ContentDocument object files in a data component (such as Table or Deck), it’s necessary to have a model on the ContentDocumentLink object with, at minimum, the ContentDocument ID reference field and the Linked Entity ID reference field."
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb
Thanks Mark.  Let me try it.
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb
I cannot determine which field in "ContentDocumentLink" links to my object "Contact_Record__c" and which field in "ContentDocument" links to "ContentDocumentLink"  
Photo of Mark DeSimone

Mark DeSimone, Official Rep

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

Please take a look at this example page, and let me know if it helps clear up the fields & relationships, and how you should set them up in a Skuid page. This is a queue that shows any Content Documents that are linked to the account in the URL param "id." You can test this with any account record that has content documents attached, and you can use the same basic setup for other objects like Contacts. I've set the queue up so that clicking it will open the Document itself up in a new browser tab. By the way, if you're in Lightning, you are also able to use the "Related List" Lightning component for Files. I've seen it used in a column on the side of a record detail page, for example, where the Skuid page provided the Record Details, and then Lightning components in the side column provided supporting materials like files and Chatter. 

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="AccountRecord" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Account" nativeuiautosync="true">
            <fields>
                <field id="RecordTypeId"/>
                <field id="Id"/>
                <field id="Name"/>
                <field id="Platform" uionly="true" displaytype="FORMULA" ogdisplaytype="TEXT" readonly="true" returntype="TEXT" label="Platform">
                    <formula>{{$Platform.Name}}</formula>
                </field>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery"/>
            </conditions>
            <actions/>
        </model>
        <model id="AccountContentDocumentLink" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" sobject="ContentDocumentLink" nativeuiautosync="true">
            <fields>
                <field id="ContentDocumentId"/>
                <field id="ContentDocument.Title"/>
                <field id="Id"/>
                <field id="LinkedEntityId"/>
                <field id="LinkedEntity.Name"/>
            </fields>
            <conditions>
                <condition type="modelmerge" value="" field="LinkedEntityId" fieldtargetobjects="Account,Asset,AssetRelationship,Automobile__c,Campaign,Case,ChannelProgram,ChannelProgramLevel,CollaborationGroup,Contact,ContentWorkspace,Contract,Dashboard,DashboardComponent,EmailMessage,EmailTemplate,Event,Grant_Year__c,Lead,ListEmail,Network,Objective__c,Opportunity,Order,OrderItem,Organization,OutgoingEmail,PartnerFundAllocation,PartnerFundClaim,PartnerFundRequest,PartnerMarketingBudget,Product2,Report,Service_Area_Year__c,Service_Area__c,Site,Solution,Task,TestObject__c,Topic,User,skuid__Auth_Provider_Credential__c,skuid__Auth_Provider__c,skuid__Component_Pack__c,skuid__Data_Service__c,skuid__Encryption_Settings__c,skuid__Feedback_Response__c,skuid__Feedback__c,skuid__Image__c,skuid__Loader_Service_Modstamp__c,skuid__Model_Service_Adapter__c,skuid__Model_Service_Credential__c,skuid__Model_Service__c,skuid__Page_Assignment__c,skuid__Page_Interaction__c,skuid__Page_Version__c,skuid__Page__c,skuid__Personalization_Settings__c,skuid__Preferences__c,skuid__Theme__c" operator="=" model="AccountRecord" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
            </conditions>
            <actions/>
        </model>
        <model id="AccountContentDocument" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" sobject="ContentDocument" nativeuiautosync="true">
            <fields>
                <field id="ContentModifiedDate"/>
                <field id="FileType"/>
                <field id="Title"/>
                <field id="ParentId"/>
                <field id="Id"/>
            </fields>
            <conditions>
                <condition type="modelmerge" value="" field="Id" operator="=" model="AccountContentDocumentLink" enclosevalueinquotes="true" mergefield="ContentDocumentId" novaluebehavior="noquery" fieldtargetobjects="ContentDocument"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <queue model="AccountContentDocument" tagrendertype="template" searchbox="true" tokenizesearch="true" showsearchbydefault="true" hideheader="false" hidefooter="false" uniqueid="sk-Hhm-449" title="Documents">
            <interactions>
                <interaction type="tap">
                    <action type="redirect" querystring="id={{Id}}" window="blank" url="/{{Id}}"/>
                </interaction>
            </interactions>
            <rendertemplate>{{Title}}</rendertemplate>
        </queue>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-HhE-276"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>