Oops, something went wrong 🙁 Error: Attempt to de-reference a null object.
-This error may happen when you attempt to generate a document and you are trying to reference object that your user does not have access too or the object is not active.
How to resolve:
1. Check the base object in document action and make sure correct base object API name is in there. If you are able to click “edit template” from document action and see all related fields to that object then you are using the correct API name and go to next troubleshooting step.
2. Check that you have a value in the ‘Email To‘ field under email section in document action. If you do not want to use email functionality, make sure whole email section is blank.
3. Check that all required fields are populated in document action. For example, if you have only part of email section filled out but one field is missing that is required to send an email, it may cause this error. Example of this is if you have email set to “preview” function, then selected to send as “attachment” but then did not have the “email to” field filled out or email template ID, it may cause this error.
4. Check that your Salesforce user has access to this base object and all other object fields being used in google doc template. The object and fields cannot be “read only” as this is restricted access.
5. Check the Salesforce sharing settings of the “Document Action” custom object and make sure set to public/edit access. You can follow these steps: Setup > Security Controls > Sharing Settings > Document Action > Change to a Public setting. If using any automation feature for app, also check the sharing rules of other custom object that comes with package “Document Request.”
6. If you made changes to document action, make sure to save it and then copy/paste the updated code into your custom button.
7. If checked all 6 above steps and still getting error message, there may be some hidden formatting in the google doc template. If you uploaded a word doc (.docx) directly to your google docs, then there may be some hidden formatting in the template causing the error message. We always recommend to start with a fresh google doc and copy section by section from your word doc template to make sure there is no hidden formatting that you may not be aware of. You can first test by replacing google doc ID in document action with the new blank copy, test to generate document and see if error is resolved. If error resolved, then you know it was issue with hidden formatting of original template and then you can copy/paste rest of detail onto your new template that has no hidden formatting.