1
votes

I'm not familiar with SOQL or Salesforce configuration but I've been asked to come up with a tool to easily import files as attachments to objects.

I'm using the Developer Console in Salesforce to figure this out. I found that the attached files are a custom object type named "File_Manager_File__c". This object contains several fields such as "File_Name__c", "Id" and most pertinently "Parent_ID__c". However "Parent_ID__c" is Apex Type: string so as far as I can tell it's not an actual child relationship (as my limited Salesforce understanding goes). Another field, "Parent_Object_name__c" is Apex Type: string and returns other objects that I would expect to have files attached (eg. "Job", "Contract", "Opportunity")

Since there doesn't seem to be an actual relationship is there still a way to join in SOQL this Object and objects that can have files attached to them such as "Order" (which has "ID" as a field)?

2

2 Answers

1
votes

It sounds like someone has done a clumsy reimplementation of the out-of-the-box Content-based attachments feature in Salesforce. The use of text fields is because Salesforce does not allow custom polymorphic relationships, like LinkedEntityId on the native ContentDocumentLink junction object.

There's no way to perform a join in SOQL without a defined relationship in the schema. These records presumably could be imported using a tool like Data Loader by populating Parent_ID__c and Parent_Object_name__c directly with values like 001000000000001 and Account, but you won't be able to query those records without performing the join synthetically in Apex or whatever language an external client is written in.

-1
votes

you can import theses data in database for example Postgresql.Only create the tables in the postgresql and import the data. So you can make any query.