Skip to content Skip to main navigation Skip to footer

Error: Insufficient permissions: secure query included inaccessible field

This error is related to an issue with your template. Please see below for possible causes and steps to resolve.

  1. Most commonly this error message occurs when generating a document under a Salesforce user where one or more fields that are being merged in the document are not accessible to the user(s) generating the document. In order to follow Salesforce security policy, all app users must have proper access to the field(s) being merged into a generated document. The field cannot be hidden from the users generating the document and they need at least “read” field accessibility. To resolve, edit field permissions: go to Setup > find related field under object > then open up security permissions or add permission for each user that does not have proper access to it. If you are not sure which field is returning the error or that user does not have proper access to from template:
    1. Remove all but a few merge fields from the Google Doc template, test and see if error happens. Gradually add a few fields at a time to see which field(s) cause the error. Once the source of the error is identified, update the permissions for the user.
    2. Or, create a new test Document Action by cloning the one returning the error, create a new Google Doc template, update sharing settings on the Google Doc template, then copy/paste a few fields at a time as the restricted user to see which fields return the error. Then update the field permissions for the user.
    3. If you have a developer or tech person that can assist, this is a quick solution to identify which fields your users do not have access to:
      1. Make a list of all fields used in your templates (go through all templates and write down the fields).
      2. Log in as a user that will use the app to generate documents, and run a script in anonymous that will check for permission for that profile.
      3. Read the results in the debug log and copy needed info to a document.
      4. Repeat steps 2 and 3 for any other profiles that will use the app for document generation. This will give you a list of all the all the profiles that need proper permissions for the list of fields in the document.
  2. Sometimes people change the API name during the development of creating their template that can cause this error. Write down all fields that are being merged and compare them to the API names listed in the Object Manager for the base object.
  3. This error can also appear if any merge field code has been accidentally cut off. Check the template to ensure merge field code is intact.