2

We have a mobile application which works with Salesforce. We want to support offline mode for this mobile application.

For that when we are loading the application, we need to store all data in mobile. From mobile, we are calling a method of salesforce which returns Json data.

When we have more record and JSON string becomes more than 6 MB it throws heap size error.

Even if we retrieve data specific to a single account, few accounts has large number of contacts which can throw heap size error.

If we divide data call into multiple API call from mobile, it hits API call limit for a day.

So, can someone suggest what is the approach to store all the data on mobile device without hitting heapsize error and API limit error.

Thanks and Regards, Ashish Shukla

  • I think you really want to scope the data you synchronize. "All Data" sounds quite impossible to maintain as your org and data grow over time. – Samuel De Rycke Sep 24 '14 at 8:48
  • You have to compromise either API calls or the data you want to retrieve. API calls are cheaper then storage. – Ashwani Sep 24 '14 at 9:35
5

If you are trying to load the data synchronously, then it will hit this limit of 6MB. I'd recommend you call asynchronously, which is nothing but using VisualForce Remoting functions.

Can you paste your code so that I'll point out a better way to go about it.

Thanks Akash

| improve this answer | |
  • Hi Akash, Thanks for your quick response. We are also trying to load synchronously. But as we have huge data and large number of mobile clients, we are just evaluating that synchronous call should not hit the API limits call per day. – Ashish Sep 25 '14 at 10:44
  • I'd suggest Asynchronous because the limit for Async is much higher (10 MB). And Using Remoting functions you definitely have better control. Make your controller method @remoting and call that using javascript, which will get you data in success call back. This will be easier to manipulate. your decision though :) . for VFRemoting - salesforce.com/us/developer/docs/pages/Content/… and salesforce.com/us/developer/docs/pages/Content/… Happy coding :) – akash Sep 27 '14 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.