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
Rachana  11Rachana 11 

Files connect

I got all the folders and files from google drive to salesforce using cloud connect to the Files tab but i want to access the data which i got from Google drive  on any page under Notes & Attachments related list
For Example 
under Accounts>>Notes & Attachments >>when i click on  Attach File Button it  should point to the data i got from Google drive and i should be able to select and save.

Thanks
Best Answer chosen by Rachana 11
LBKLBK
hi Rachana,

FilesConnect usage is not that simple, yet.

What you can do is setup a Junction Object to relate your Account object (any other standard or custom object where you need the files to be attached) with the external object (it would be named as item_google_drive or something similar to this).

I have followed the steps below.

1. Create an object Named Google_Drive_Files__c

2. Added a Lookup relationship to Account object

3. Added an "External Lookup" relationship with item_google_drive object

4. If you need any file specific information (like DisplayURL, etc.) in your Junction object, you can use a BEFORE INSERT / BEFORE UPDATE Trigger on the Junction object for that

This object will naturally shown as a Related List in Account Page layout, just like Notes & Attachment.

Hope this helps.

All Answers

LBKLBK
hi Rachana,

FilesConnect usage is not that simple, yet.

What you can do is setup a Junction Object to relate your Account object (any other standard or custom object where you need the files to be attached) with the external object (it would be named as item_google_drive or something similar to this).

I have followed the steps below.

1. Create an object Named Google_Drive_Files__c

2. Added a Lookup relationship to Account object

3. Added an "External Lookup" relationship with item_google_drive object

4. If you need any file specific information (like DisplayURL, etc.) in your Junction object, you can use a BEFORE INSERT / BEFORE UPDATE Trigger on the Junction object for that

This object will naturally shown as a Related List in Account Page layout, just like Notes & Attachment.

Hope this helps.
This was selected as the best answer
LBKLBK
A small correction in the above answer. You may not be able to access the External Object within a trigger. But, you can still write a Batch Apex and schedule it.
Rachana  11Rachana 11
Do we need to create look up or master detail relationship.
Is there a way that we can access through Notes & Attachments instead of related list.
Rachana  11Rachana 11
when i tried to implement the solution you gave like creating 1 MD relationship and 1 External Lookup Relationship i got the related list but when i access the file that i associated it throws an error "External Object Error
This data is no longer available. The record with external ID "XXXXX" is currently unavailable in the external system. Try again later or contact your administrator for help. 
LBKLBK
Can you goto your External Data Source and click on "Validate  and Sync" once?
Rachana  11Rachana 11
yes done that
LBKLBK
Hi Rachana,

It could just be a data issue.

Please run an SOQL query on your items_google_drive__x object to see that the specific record exists.

Or, after the validate and sync, try to add another file to the new junction object.

If the error persists, can you please share a screen shot of the error.
Rachana  11Rachana 11
User-added imageUser-added imageUser-added image
 I am able to select the file and save it but when i try to access the file i saved, I am getting this error.
I think there is problem with the  file URL because when i run SOQL query the url is different and the url i see here is incomplete.
 
LBKLBK
Is the DisplayURL field populated? This would be the field that carries the actual path of your file.
Rachana  11Rachana 11

Thanks so much for your patience, finally i got the issue.The length of the field is less so the url the being incomplete and when i increased the size its working.Hurray !!!

Just for Info...Does it make any difference if i create Look up or master in the junction object which you suggested earlier?
LBKLBK
It doesn't make a difference.

I suggested Lookup relationship because you can make use of the same Files custom object to relate files to multiple standard and custom objects like Account, Opportunity, Project__c, etc.

All you need is an additional Lookup field to the specific Object and you are good to go.

Please mark your question as solved.
Rachana  11Rachana 11
Once we get them as a related list and access, all the subfolders and folders are also appearing as files link.  Did you face this issue?