You need to sign in to do that
Don't have an account?
Smita Hodiggeri
How to bulkify the following query to get all the notes and attachments in an org from any object (or obj is also fine)
I am looking to use the following query to bulk query all the notes and attachments in an org(or by object) so that I can do the migration of N&A's to Files (pre Spring '16 N&A's). Can someone give me a hand with this?
The results are way too many and I am hit with too many exceptions even for a month range. Can some one help get past that stupid error so that I can get a nice list of the notes & attchments created on accounts before 01012016?
I am looking to execute this in ANon window or just a simple SOQL query would be a dream!!
Your time and thoughts are much appreciated.
Thanks,
List<Account> accList = [SELECT Id,Name ,(SELECT RecordType FROM CombinedAttachments AS S WHERE (CreatedDate >= 2015-01-01T23:59:59Z AND CreatedDate < 2016-02-01T23:59:59Z) AND (S.RecordType = 'Note' OR S.RecordType = 'Attachment')) FROM Account];
Set<Id> accSetId = new Set<Id>();
for (Account acc :accList){
if (acc.CombinedAttachments != null) {
accSetId.add(acc.Id);
system.debug('acc:'+acc);
}
}
The results are way too many and I am hit with too many exceptions even for a month range. Can some one help get past that stupid error so that I can get a nice list of the notes & attchments created on accounts before 01012016?
I am looking to execute this in ANon window or just a simple SOQL query would be a dream!!
Your time and thoughts are much appreciated.
Thanks,
List<Account> accList = [SELECT Id,Name ,(SELECT RecordType FROM CombinedAttachments AS S WHERE (CreatedDate >= 2015-01-01T23:59:59Z AND CreatedDate < 2016-02-01T23:59:59Z) AND (S.RecordType = 'Note' OR S.RecordType = 'Attachment')) FROM Account];
Set<Id> accSetId = new Set<Id>();
for (Account acc :accList){
if (acc.CombinedAttachments != null) {
accSetId.add(acc.Id);
system.debug('acc:'+acc);
}
}
try with below code. In the above i am quering Notes & attachemets related to the account object. Likewise you can do for other objects.
Refer the below link.
https://salesforce.stackexchange.com/questions/248812/what-is-the-right-way-to-query-all-notes-attachments
If this helps, Please mark it as best answer.
thanks!!