1

I want to create a batch class for the ContentdDocumentLink. I am getting records in the querylocator. But the execute() method is not working. In the debug logs also I am not able to trace any problem. The debug log is showing Internal Salesforce.com Error. May I know is there any limitations as such to the ContentDocumentLink object?

Here is the code sample:

global class CommunityActivityJob implements Database.Batchable<sObject>,Database.AllowsCallouts ,Database.Stateful {
global Database.QueryLocator start(Database.BatchableContext BC) {
List<String> linked = new List<String>();
linked.add('00528000000M2xj');
   String query = 'Select Id, ContentDocumentId, LinkedEntityId, ShareType, Visibility from ContentDocumentLink Where LinkedEntityId In :linked ';
    System.debug('===START==='+Database.query(query));
    return Database.getQueryLocator(query);
}
 global void execute(Database.BatchableContext BC, List<sObject> scope) {
    System.Debug('===INSIDE EXECUTE==='+scope);
    }
global void finish(Database.BatchableContext BC) {
    System.debug('===Inside Finish===');
}

Here is the Debug logs result:

02:15:35.0 (368461)|EXECUTION_STARTED 02:15:35.0 (372197)|CODE_UNIT_STARTED|[EXTERNAL]|01p2800000FdNp2|CommunityActivityJob 02:15:35.0 (3586564)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 02:15:35.0 (25452249)|FATAL_ERROR|Internal Salesforce.com Error 02:15:35.25 (25736049)|CUMULATIVE_LIMIT_USAGE 02:15:35.25 (25736049)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 200 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 60000
Maximum heap size: 0 out of 12000000 Number of callouts: 0 out of 0 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 0 Number of queueable jobs added to the queue: 0 out of 1
Number of Mobile Apex push calls: 0 out of 10

02:15:35.25 (25736049)|CUMULATIVE_LIMIT_USAGE_END

02:15:35.0 (25817145)|CODE_UNIT_FINISHED|CommunityActivityJob 02:15:35.0 (26892816)|EXECUTION_FINISHED

Thanks for your response.

Your Answer

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

Browse other questions tagged or ask your own question.