I am trying to get details of space used by several sObjects, Attachment and other using Apex code. I can get Attachments details but is there any possibility to get how much data has been consumed by an sObject e.g; Case, Lead etc..

In my opinion this may not possible. Any ideas ?


There is no API for this currently, either Apex or otherwise, one could envision it one day being part of the Metadata API (or Tooling API?) perhaps, but currently not. The only programatic way to do this would be to screen scrape the information from the Data Storage page yourself in Apex code. Its far from ideal but could be done if you are happy with the risks (e.g. the HTML changing in future platform releases or fixes and you have to tweak your parsing logic). Here is a post from Metadaddy describing the process and the warnings... screen scrape Salesforce with REST GET call from Apex

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.