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
admin twentyoneadmin twentyone 

Issue with Salesforce Ajax Toolkit (connection.js)

I am trying to download Salesforce Chatter files using Ajax Toolkit of salesforce. Once the file (which is in string format) is downloaded, convert it to blob and then upload to ShareFile(File Storage Solution).
I have observed that each Chatter file can have maximum size of 2GB. However, with the Ajax Toolkit route I am facing Out of Memory issue in Internet Explorer for file size greater than 15MB. Same error occurs in Firefox when file size is greater than 30MB. Is there a better way to download Chatter files other than using Ajax Toolkit. 

What I am doing is similar to the example here : https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_more_samples_asynch.htm

My Code:
Var result = sforce.connection.query('select Title,versiondata,versionnumber,FileExtension,ContentSize   from contentversion where Id in (\'' + idList  + '\') Order By versionnumber DESC',{
            onSuccess : success,
            onFailure : failure
        });

Exception/Error Trace:
Error occurs at line 635 in ../../soap/ajax/40.0/connection.js
 
} else if (holder.connection.status == 200 && holder.connection.responseText != null && holder.connection.responseText != "") {



 
NagendraNagendra (Salesforce Developers) 
Hi,

Ajax Toolkit is ancient, blast from the past when we used S-Controls. It might be introducing some extra memory footprint. Is your integration capable of making REST calls? REST API and/or Bulk API could work nicely. But if it's browser's limitation you're hitting you might have to do it another way, with Data Loader maybe or proper server-side tools... There are apps for that ;) Dataloader.io, Informatica Cloud, maybe even some connectors on AppExchange you could use.

Thanks,
Nagendra 
Laxman Samala 6Laxman Samala 6
I see that your are using api version 40, try using api version 36 or older and see if you are still having an issue. Connection.js is ancient as pointed out by Nagendra, go with older api version and see if it works.