function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nitesh SisodiaNitesh Sisodia 

Change parent records of all "Salesforce Files Records" from standard contract object to some custom contract__c object

As we already know that Sandard Contract Object have a Files Related List on detail page layout. One of my colleague wants those Files must move to some Custom Contract__c object's "Files Related List"

Files Related List on Contract Object

I have already tried adding a custom Lookup Relationship field (parentId__c) in "Salesforce Content Version Object" to Contract__c custom object, and later assign contract__c ID in parentId__c field. But the records are coming in "Content Version" related list not in Files Related list, which is not according to requirement.

A little help in this would be appreciated !!
sfdcMonkey.comsfdcMonkey.com
hi Nitesh Sisodia 
you can add file related list on your custom object
in the setup ---quick find box search --> object --> select your custom object
in object detail  page go to Page Layouts and click on edit link now select Related list in panal and add File object in your custom object related list pagelayout 
User-added image
Thanks
mark it best answer if it helps you :)
Nitesh SisodiaNitesh Sisodia

@Piyush, Thanks for reply,

Just to add more clarification to my question,

All I want to move is, all the salesforce Files records which belogs to standard Contract Object (Contract) to  A Custom Contract Object (Contract__c). (Obviously, as a child records)

Lets suppose, I have multiple standard contracts which have multiple files attached as Salesforce Files, [Note : Its not attachment]

Contract Records :

Contract.IdContract.NameFile
005a4K58000004Contract1FILE1, FILE 2 , FILE3
005a4K58000003Contract2FILE4, FILE 5
005a4K58000002Contract3FILE6

Contract__c Records :
Contract__c.IdContract__c.NameFile
00aa4K58000001Contract1 
00aa4K58000002Contract2 
00aa4K58000003Contract3 

After map those same files to Contract__c, the final result would be something like, below table :  
Contract__c.IdContract__c.NameFile
00aa4K58000001Contract1FILE1, FILE 2 , FILE3
00aa4K58000002Contract2FILE4, FILE 5
00aa4K58000003Contract3FILE6


Because, Records in Contract and Cotract__c have same name, I was planning to write some apex around this which can copy all the Files from Contract to Contract__c, but doesn't find anything good around this.

As we know, that files and contentversion represents the same records, So I have already tried adding a custom Lookup Relationship field (parentId__c) in "Salesforce Content Version Object" which points to Contract__c custom object, and later assign contract__c ID in parentId__c field. But the records are coming in "Content Version" related list not in Files Related list, which is not according to requirement.

 

Thanks,