Skip to main content
Hello, we recently delete several files from our org. Some of those files were related to unconverted Leads, and others were deleted from converted Leads. We want to Undelete the files that were related to Converted Leads. How would I write that query?  Thank you.
8 answers
  1. Jun 24, 2020, 6:05 PM
    Hi Michael, 

    There are several ways of doing it

    For example:

     

    Contact[] c = [select id from contact where isDeleted = true LIMIT 1000 ALL ROWS];

    As we are talking about files, you should add isDeleted to ContentDocumentLink

     

    SELECT ContentDocumentId, LinkedEntityId  FROM ContentDocumentLink where LinkedEntityId: (Your linkedEntity ID) and LinkedEntity.Type= (Your LinkedEntityType)

    1. In the Data Loader, click Export All.
    2. Select the object and choose the target for export file. Click Next.
    3. Click Select all fields.
    4. Create filter 'IsDeleted' = True. Click Add Condition.
    5. Click Finish.
    6. Open the CSV file.

    Reference: 

    https://help.salesforce.com/articleView?id=000321526&language=en_US&type=1&mode=1

    Let me know if this helps

     

    Anudeep

0/9000