Salesforce - Can't access Files of records connected by a lookup relationship

  • 30 March 2023
  • 2 replies


Custom object “Pre-Job QC” with look-up relationship fields to custom object “Equipment”


I need to access this file here on the Equipment:


This Pre-Job QC record has a look-up relationship field to the above Equipment record:

I go to run the “Select DocGen Package” and that Equipment’s file isn’t an option (nor are the other Equipment files also attached by a look-up). The below files are what’s directly in the Pre-Job QC record’s Files:



Best answer by matthew_mcgrath 17 April 2023, 21:38

View original

2 replies

Userlevel 1
Badge +3

Hi @rpilawski - I can think of 2 options:

  1. Use a Screen Flow and the Preview DocGen screen flow action - Query for the Files/Attachments on the parent record. Present these to the end user to select from. Pass the value(s) to the “Attach Ids” field of the Preview DocGen Action.
    • Note - I haven’t built this myself but, in theory, it should work. 
  2. Use a button with the “parentIds=” parameter.
    • The picture shows a generate documents button on a custom object. This button pass the “&parentIds=” parameter. It is followed by a field that looks up to the parent (Account) record. I was able to find the parent record Id field by using the “Insert Merge Field” dropdown.


The Lightning Component you’re using does not pass record Ids within it and is not customizable.

Although you built a relationship to the parent (“Equipment”) object within your DocGen Package, we do not query for that data until you hit “Run Document Package” and the document is generating. 

Helpful articles:

Userlevel 5
Badge +20

Hi @rpilawski 
Does this solve your question?