Author Archive

Error while creating new document. Error message: Error: 500.

Error Message:
Error while creating new document. Error message: Error: 500. Error description: { “error”: { “code”: 500, “message”: “Internal error encountered.”, “status”: “INTERNAL” } }


  1. Check if this error happening under all users or just non admin users. And refresh your app authorization with google drive under documents configuration tab.
  2. If refreshing your authorization did not resolve error, you may have an extra “{” possibly in your google doc template in one of your merge fields or wrong formatting on one of your merge fields. Or you may be missing an opening { or closed bracket } in one of your merge fields causing this error and improper formatting of the field. So you should check all merge fields within template and ensure following right formatting when selecting the field from the embedded template builder in document action template.
  3. If not the above two reasons, there could be some hidden formatting within your template causing this error message. If you uploaded your google doc template from a word document, there is a chance there is hidden formatting in there. You can test by creating a blank google doc (do not copy the original one), update sharing settings and then replace this google doc ID into your document action. Then test to see if error comes up. If it does not, then you know it is an issue within your previous template and if you cannot find the merge field it is coming from, then it may be issue with hidden formatting and you need to recreate your google doc template and can copy/paste from old template to new template so you can be sure no hidden formatting.

Why are Document Requests stuck in “New” Status

Issue:  Document Requests stay stuck at “New” and do not get processed. How to resolve this?


  1. Update App Package on App Exchange: We advise that you update your package to latest available on AppExchange when possible to ensure you have latest app feature updates.
  2. Authorization or User Permissions Issue: Check that user generating document is an assigned user to the app and has permissions to document request object, document action object, fields in use, VisualForce pages, Apex classes, and any other app package components. You can also refresh your app authorization under DocGen Configuration tab to refresh the process and check settings for forcing authorization if using this feature.
    1. If you are having an issue with Document Request records getting stuck in “new” when triggered by guest site user, see #4, “Batch Mode Automation”.
  3. Fix or remove Error Field: If you indicated a field for the “error field” and that field does not exist or is not the correct API name on that base object, the document requests will not process and will stay in the New status. For example the automation article for Document Request objects suggests to use “doc_gen_error” for this Error field though you would still need to create this field under your base object and does not come with installed package since this field is optional. To resolve you should create the field or fix the API name of the field you want to save the error to on the base object so it is correct. Or just remove the field API name from that field on the document request object as this is an optional feature. The “error message” field will still populate on the document request object. Optionally you can also populate the same error on your custom field on the base object if desired.
    1. If you are using process builder to populate this “error field” value, be sure to fix that as well.
    2. You must fix all the current Document Request records in order to remove them from the queue. Optionally you can change the Status of the existing Document Request records to Complete instead of fixing the error field so the app will no longer try to process them.
  4. Batch Mode Automation: If you find no issue with the error field or not using it, then it may be an issue with Batch Mode Automation or the Process Builder setup. You can review more details of using automation with document request in the automation article as well as speed of document generation (ensure you have waited at least a few minutes to allow the document request to process and update status).
    1. If you have A5 Documents package 2.109 installed, batch mode is already enabled to use document request object automation and is not available on the Administrator VisualForce page to enable or disable. If you waited long enough for documents to be processed through automation and still stuck in “new,” you should refresh app authorization under DocGen Configuration tab and check all steps in automation article for using Document Request object with automation.
    2. If you have an app package 2.101 or older installed and using batch mode feature for automation, you should disable this setting (Setup > VisualForce Pages > Administrator > Preview > disable batch mode > enable it again). Then go to documents configuration tab and refresh app authorization with google drive. This will refresh the settings as there may have been a change in app process or the user that authorized the app causing process to not work consistently.
  5. Issue with Apex job: If you did not resolve with the solutions above and cannot figure why the document request is getting stuck in “new” status, you may have an issue with Apex job. When process builder is being used for Document generation, new Apex job is launched and currently, the newly created Apex job gets stuck in status ‘Holding’. This is  a known issue that can happen on the Salesforce platform. You may notice that some other Apex jobs for the processes that are not from the A5 Documents app package also got stuck in ‘Holding status.’ On this link, you can find the solution for this issue. You must contact Salesforce support and explain to them the issue you have and they will resolve it. Unfortunately, A5 Apps cannot contact Salesforce support for you since we do not have proper access to your org. Note that your custom button for manual document generation from a record with same related document action may work as it doesn’t use batch Apex for document generation so you can use it as a workaround until Salesforce support fixes your error.

Error Message: sObject type ‘rsdoc__Document_Action__c’ is not supported

Full Error Message:
sObject type ‘rsdoc__Document_Action__c’ is not supported. If you are attempting to use a custom object, be sure to append the ‘__c’ after the entity name. Please reference your WSDL or the describe call for the appropriate names.

You may see this error message is your app subscription was suspended due to 4 failed payment attempts to your credit card on file in AppExchange. The billing contact would have received an email each time app payment failed to let you know it would be suspended on 4th automated attempt. You will need to reactivate the app subscription by following these instructions. Make sure you are logged into only your Production Salesforce org and related AppExchange account when reactivating or modifying your app subscription.

Using Email To field with other Objects

Use Case:
I would like to use the Email To field in document action from another object that is not Lead Or Contact ID (these objects are specified as only objects to work with automating merge field in “Email To” field in document action article).



If you setup a button to generate and email the document with an email preview then you can populate a merge field in the Email Additional To in the button code and or on document action to populate an email address or multiple that you can merge from some formula of related record for example. That will generate the document and then compose an email and populate the email additional to field on the standard send email page without needing to use a Lead or Contact ID in the email to field (you can leave the Email To field blank in document action).

If you want to have an automated email send in background without user clicking the button to generate document from record, this requires a Contact or Lead ID as explained in the document action article. The Contact and Account objects are included in licenses as standard objects and are the only standard objects included. So you can leverage them for your base object in document action instead of building a custom one.

You could also consider creating a matching account/contact in background and using a lookup field to relate them. Typically all emailing type functionality across many apps and integrations with email marketing tools requires use of leads or contacts (for tracking email activity, etc.).




RTF Printing Control Codes – Suppress HTML Codes?

When we print a RTF field we get the control of HTML Codes.  Is there a way to suppress these?
Resident has breakfast waiver</p>
App Expert Reply:
You can create a formula field or workflow to copy the text to a text field. Or formula to display text only. Depending on length of field text.

Error Message: Only aggregate expressions use field aliasing

Full Error Message: “Only aggregate expressions use field aliasing (rsdoc)”

Reasons you may see this error message:

1. You may be trying to merge a rich text field in that document. If so, then this format is not supported by our app:
2. May have an issue with formatting of one of your merge fields in the google doc template or embedded symbol in a table.

Some things to help you test if issue is one of the fields/tables:
-Replace a new google doc ID into that document action (can even be blank) just to make sure the error is not coming from the document action settings. 
-Decode one section of merge fields at a time in the google doc template used. So for example if you had merge field {!Account.Name} you can decode it be removing the first bracket so it would change to !Account.Name}. Then do this one by one or section by section to isolate where the error is coming from. Then you can add the first bracket { back in once you have resolved which field was causing it. 
3. If not one of the reasons above, there may be an issue with some hidden formatting in that google doc template. You can create a brand new google doc and merge fields in manually to recreate your template. Then test and make sure no error. If no error then yoiu know it was hidden formatting and you can finish building your template using the new google doc ID.

Error: Aggregate query has too many rows for direct assignment, use FOR loop

Full Error Message:
“Error while creating new document. Error message: Aggregate query has too many rows for direct assignment, use FOR loop”

  • This error may happen when generating a document that has hit a limit with related list items. A limitation could be reached with a combination of the related list tables and long text fields from a specific record.

To troubleshoot this error message:

  1. There are many variables as to why a document could time out and this error to be caused so it may take some trial and error to see how to resolve.
  2. First, see if this error is happening on one record or multiple records that have different amounts of related list items. Can try to generate document from a record with less related list items and see if error persists.
  3. If using a long text field in your template: you may be able to resolve this too many rows/timeout error by reducing the value of characters in this long text field.
  4. If issue is trying to merge too many related list items into the document, you can somehow split up the related list by using the filter feature in template builder:
  5. You can try to isolate which related list merge field is returning the error message  by decoding different related list merge fields. For example in your document you may have a related list merge field that looks like {!Opportunity.r.OpportunityLineItems.Quantity} and to “decode” it temporarily to isolate where the error is coming from, you can just remove the first bracket so it becomes !Opportunity.r.OpportunityLineItems.Quantity}. You can do this one by one to see which of the merge fields is causing the error and go from there. Or paste these fields alone in a new google doc template so you can be sure no hidden formatting that could cause it to time out.
  6. Make sure have latest A5 Documents package installed from AppExchange.
  7. If you have done above steps and error persists, you may have found an app limitation with amount of related list fields combined with long text area fields, see example below.


Example Limitations found on combination of the related list tables and long text fields is hitting a limit:

-When I recreate the related lists only, there is no error, even with related lists on two separate child records
-When I add a single 2000-character long text field to the template along with the related list tables, there is no error.
-When I add two long text fields (2000 char + 32000 char Campaign Description field, length not customizable) to the template along with the related list tables, I get the “Aggregate query has too many rows for direct assignment, use FOR loop” error.

So in sum, the error happens when there is a combination of the related list tables and long text fields that is hitting a limit.


Issue with Email in Spam Folder

My generated document or eSign document is going to my spam folder in email account (gmail). What can I do to have this email come to normal inbox?

App Expert Reply:
Since emails are sent through Salesforce when using our app, the email deliverability is controlled by Salesforce.

Please refer to the this help article about setting up email deliverability and following best practices:
And this one:
In addition, you can take advantage of setting up an org wide email in your document action following this article so the email comes from a company domain to recipient: