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
Suman KuchSuman Kuch 

How can we make large number of callouts?

Hi,
We have onetime files (roughly around 100,000) migration from legacy system to Salesforce. The migration can be done by an expert and after complete migration we need to move Attachments from Salesforce to Box (external file system, due to storage limits on our Salesforce account) using REST api calls and from the response I'm creating Custom attachment object and storing box file metadata (like file name and file id). When it comes to one or two attachments per transaction then it fine but How can we send these 100,000 attachments to Box? I see some Apex limitations on callouts but I need an idea on how to send these? Is there any approach to split these into chunks and make calls?

Please advice. 

Thanks,
Sumant K
Alain CabonAlain Cabon
Hello Suman,

I have upload thousands of attachments with the dataloader but you want to export all the attachments.

• Data Loader currently does not support the extraction of attachments.

As a workaround, we recommend that you use the weekly export feature in the online application to export attachments


User-added image


It is a free Developper instance above so it is monthly but you can get all your attachments out of Salesforce by this way.

Best regards and happy Christmas!

Alain

 
Alain CabonAlain Cabon
I made a test and it is very easy.

Attachment.csv  ; contains the IDs and the name of the files in attachments.

The folder Attachments contains all the attachments with their IDs as name. I just renamed some files with their complete names ( JPG, PDF and XLS ) and these files have be opened directly (no encryption used here). 
 
Alain
Suman KuchSuman Kuch
Hi Alain,
Thanks for your reply and approach is good but here as soon as I moved the attachment to BOX I have to delete the record form "Attachment" object. In this case would that be possible? 

In the meantime I was thinking another scenario, i.e. put all files in "BOX" and get files information (filename, fileID) via BOX Folder Read API and create Custom Attachment for earch file?
Alain CabonAlain Cabon
Hello Suman,

There are no problem for deleting all the attachments as soon as you have the Attachment.csv file which contains all the IDs of the attachments using the data loader.

You can follow the detailed steps by Patrice E. Allaire with the Data loader tool here: Can I mass delete notes & attachments?
https://success.salesforce.com/answers?id=90630000000gyyaAAA

Your code using REST api calls  from Apex lcallouts can still be very usefull for the last attachments created after the weekly export if you don't want to wait a week before the next global export of data.

Dataloader can load or delete all the attachments but it cannot export them so only the weekly global export of data is the workaround for thousands of attachments. Otherwise, the solution with Apex is very difficult technically as you have noticed (the governor limits are too contraining)

Best regards

Alain