3

I have searched the web with no success of finding a solution for this yet. How can I report on an objects records to find which ones have notes and attachments?

  • How many attachments do you have in your org ? – Mohith Shrivastava Jul 5 '14 at 16:29
  • does it matter? it could be 100's or 1,000's I'm not sure. – Bart Jul 5 '14 at 16:33
  • ok i have a solution provided your attachment count is less than 50K . – Mohith Shrivastava Jul 5 '14 at 16:36
2
Select parent.type, count(id) from note group by parent.type

You can execute this from the developer console, workbench, data loader, a Visualforce page, etc.

| improve this answer | |
1

If your attachment count is less than 50K then the following should help

List<Attachment> lst=[Select Id,ParentId,Parent.Type from Attachment ];
Set<String> setObj=new Set<String>();
for(Attachment att:lst){
   setObj.add(att.Parent.Type);
}
system.debug('OBJECT SET'+setObj);

If its more than 50k then i would use query more and generate same or use a VF in read only mode and run the same program .Or probably use OFFSET to keep building this set .

Probably we need same type of query on Notes as well to generate our object SET .

| improve this answer | |
  • should I build a page and use that code in it? Can you give an example/illustration of how it would work? – Bart Jul 5 '14 at 20:47
  • You can use a VF and Pass the SET in a list as Getter and Setter.The log would give you all objects that has notes and attachment anyways – Mohith Shrivastava Jul 6 '14 at 12:17

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.