I am doing a scheduled batch function. When I runing the batch class, it will occur a 'UNKNOWN_EXCEPTION' this is the information of the exception:
Apex script unhandled exception by user/organization:
005M0000000Dk0p/00DM00000008c2d
Source organization: 00D80000000LyP5 (null)
Failed to process batch for class 'HsAppExtEventBatchClass' for job id
'707M00000004nRD'
caused by: System.DmlException: Update failed. First exception on row 96 with id 00UM00000016W9HMAU; first error: UNKNOWN_EXCEPTION, An unknown exception has occurred.: []
Class.HsAppExtEventBatchClass.execute: line 40, column 6 External entry point
Is here any one can provide me with any solutions or suggestions?
global void execute (Database.BatchableContext bc, List<sObject> scope){ Date t = system.today() - 365; RecordType rt = [select id,name from RecordType where name='Locked Activity Type']; List<Event> evList = new List<Event>(); List<FeedPost> fpList = new List<FeedPost>(); List<ID> eventIdList = new List<ID>();
for(sObject s : scope){ Event ev = (Event)s; ev.PreCall__c = null; ev.PostCall__c = null; ev.Description = null; ev.RecordTypeId = rt.Id; ev.Status__c = 'Did not occur'; if(ev.DurationInMinutes>0){ evList.add(ev); eventIdList.add(ev.id); } }
EventFeed[] cfList = [SELECT Id, FeedPost.id FROM EventFeed where ParentId = :eventIdList and CreatedDate < :t]; for(EventFeed cf: cfList){ fpList.add(cf.FeedPost); }
Hello friend the mistake should be query which is used in Batch class
Old Query :
EventFeed[] cfList = [SELECT Id, FeedPost.id FROM EventFeed where ParentId = :eventIdList and CreatedDate < :t];
Modifed Query
EventFeed[] cfList = [SELECT Id, FeedPost.id FROM EventFeed where ParentId IN :eventIdList and CreatedDate < :t];
since you are using list it will return exception try the code.
Hello friend the mistake should be query which is used in Batch class
since you are using list it will return exception try the code.
Hope this helps
Regards
Raumil Setalwad
thank for your suggestion, I do will try your code later.
but I dont think it's the main reason of the exception.