You need to sign in to do that
Don't have an account?

Batch Class on ContentDocumentLink
I have tried to create a Batch Class on the ContentDocumentLink. The querylocator in the start method is returning some records but it is not able to execute the execute() method. I am getting Internal Salesforce.com Error. May I know is there any limitations to this object?
Here is the code snippet I am using:
Here is the code snippet I am using:
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==='); }
https://salesforce.stackexchange.com/questions/76121/retrieve-all-contentdocument-ids-whose-related-contentdocumentlink-record-is-upd
It is mentioned as: You can't run a query without filters against ContentDocumentLink.
Hi Saurav,
Please post the error message.
Thanks,
Gaurav
Skype: gaurav62990
and try again.
Thanks,
Gaurav
@run-time this should be changed to "temp" not "linked"
This means, the variable is not providing value to salesforce.
Add the debug state before Database.query() and find the actual query build.
Thanks,
Gaurav