1

I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and then deletes the original file (whilst returning the link to it). Everything is working fine. Within the trigger context I have the Trigger.new collection that I can query against and use in as a part of my code.

I am now wanting to replicate this logic but as part of a scheduled job. The logic is that if the trigger doesn't work for whatever reason (web server not available etc) then the files remain within Salesforce and then every hour this batch job will run collect all of the records that didn't work and then repeat the exercise to try to get the files across to the DMS.

So essentially what I need is to be able to query the ContentDocumentLink object and pull back a list of records that I need. Its proving to be a more difficult task to do and I am getting the following error:-

"Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator."

How am I able to get a collection of records that I can work with? - Many thanks :)

  • It would be easier to help you if you edit your post to include what you have so far. – Adrian Larson Apr 30 at 1:49
  • 1
    Maybe try doing a query on ContentVersion or ContentDocument itself and work it from that angle – Brian Miller Apr 30 at 8:21
  • thank you Brian - what you suggested did work for me – David Leckenby May 1 at 0:16

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.