0

I have files (ContentDocument) attached to a Lead on conversion I map the Lead to a custom object trough process builder. Is there a Id or field I can use to map the files attached to the custom object or do I need to write a trigger?

2
  • 1
    You have to use trigger and create contentDocumentLinks for the new record Jan 28, 2019 at 9:52
  • @PranayJaiswal Ok so there is no way to get the ContentDocumentId? If so please update your comment as an answer.
    – Thomas
    Jan 28, 2019 at 10:07

1 Answer 1

1

Via trigger route, You can Query on ContentDocumentLink object to get all the files related to the any particular record. LinkedEntityId on ContentDocumentLink tells ID of the linked object. Can include Chatter users, groups, records (any that support Chatter feed tracking including custom objects), and Salesforce CRM Content libraries.

A sample query which you can modify as per the requirement:-

SELECT ContentDocumentId  FROM ContentDocumentLink WHERE  LinkedEntityId = '0D5000000089123'

For getting the ContentDocumentID, You can store the ContentDocumentID in set variable and query on ContentDocument object. Link it with the new Custom Object record using insertion of ContentdocumentLink object.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.