When you click Generate Document, you expect a new file on Salesforce to show the data you fetched. Besides the file, the generation process creates new records:
This record is crucial for document creation and is the main part of the entire application. It's always created when document generation starts.
Document Requests are created by inserting them into the database. Just like every object in the Salesforce system, there are different ways of inserting Document Requests. The main is through Flows and Apex Code. Buttons can also be added to record pages tied with the document query. These buttons can be placed on a single record's layout, and allow for record-specific document generation.
The "Batch" Processing Type is an exception. It needs to be run separately to start generation.
The status of a "Document Request" record reflects the status of the generation process. You can check the status of document generation by checking the "Status__c" field on requests:
New
. The processing has not yet started.Processing
. The request is being generated.Completed
. The document has been generated and is available in whatever format and location you specify.Error
. Document Generation ended up in an error.Cancelled
. The processing was cancelled.The newly created Document Request can only have the "New" status.
The fields displayed in the created Document Request may vary depending on the Document Template used.
Here is the list of all fields that the "Document Request" record contains:
Field API Name | Values / Type | Description |
---|---|---|
Name |
Auto Number |
The "Document Request" number. Automatically assigned by the app. |
OwnerId |
Lookup(User,Group) |
Lookup to the owner of the record. |
Record_Id__c |
Text |
ID of the record that document generation started from. |
Status__c |
New , Processing , Completed , Error , Cancelled |
Current status of the record. |
Document |
Lookup |
Lookup to the "Document Template" record that this Document Request is using. |
Document |
Lookup |
Lookup to the "Document Solution" record that this Document Request is using. |
Document |
Text |
The title of the generated document. |
Document |
PDF , DOCX , Google Doc , Google Sheet , XSLX , CSV |
The format of the generated document. |
Save |
Salesforce File , Salesforce Attachment , Google Drive File , OneDrive |
How the generated document should be saved. |
Processing |
Queue , Batch , Synchronously |
How the record is processed. |
Error |
Long Text Area |
Descriptive text containing an error message if such an error occurred. |
Reuse_File |
Checkbox |
If checked, the Content Version is linked to the existing Content Document. Otherwise, a new Content Document is created. |
Network |
Text |
Salesforce Community/Network ID that is applied to the Salesforce File. |
Share_ |
Long Text Area |
Comma-separated values of users' emails, that have the "Edit" permissions to the generated document. |
Create_ |
Checkbox |
If checked, the OneDrive link with "Edit" permissions is created. |
Share_ |
Long Text Area |
Comma-separated values of users' emails, that have the "View" permissions to the generated document. |
Create_ |
Checkbox |
If checked, the OneDrive link with "View" permissions is created. |
PDF_Conformance_Level__c |
PdfA1a , PdfA1b , PdfA2a , PdfA2b , PdfA2u , PdfA3a , PdfA3b , PdfA3u |
Levels of conformance for PDF documents. |
PDF_Version__c |
PDF_1_0 , PDF_1_1 , PDF_1_2 , PDF_1_3 , PDF_1_4 , PDF_1_5 , PDF_1_6 , PDF_1_7 , PDF_1_8 , PDF_2_0 |
The version of the PDF specification to which the PDF document conforms. |
Embedded_Data__c |
Long Text Area |
JSON that should be embedded in the document. |
Language__c |
Text |
Defines the language of the Template Label. |
Locale__c |
Text Area |
Defines the Locale in which data is shown in the generated document. |
Folder_Path__c |
Long Text Area |
Defines the destination point of the generated document on Drive. |
External |
Text |
The ID of the generated document in the external system (e.g. Google Drive). |
External |
Text |
Name of the generated document in the external system (e.g. Google Drive). |
File |
Text |
Salesforce File or Attachment ID. |
External_ |
Long Text Area |
The URL of the generated document in the external system (e.g. Google Drive). |
External |
Long Text Area |
The URL of the generated document with the "Edit" access on OneDrive. |
External |
Long Text Area |
The URL of the generated document with the "Edit" access to the defined users on OneDrive. |
Failed |
Long Text Area |
Comma-separated list of email addresses of users for whom document sharing failed. |
External |
Long Text Area |
The URL of the generated document with the "View" access on OneDrive. |
External_ |
Long Text Area |
The URL of the generated document with the "View" access to the defined users on OneDrive. |
Failed |
Long Text Area |
Comma-separated list of email addresses of users for whom document sharing failed. |
LastModifiedById |
Lookup |
Lookup to the user who last edited the record. Includes the date and time of the last edit. |
CreatedById |
Lookup |
Lookup to the user who created the record. Includes the creation date and time. |
So what do all these fields allow us to achieve? They offer more options when generating documents and allow users to customize the generated document to achieve the needed result. For example, the "Document Format" field allows the user to choose between options for saving the resulting document. The "Save As" field allows users to further decide where the created document resides: on Salesforce as a File or Attachment or just on Google Drive of the organization.
When creating a Document Request, you are not limited by the options in Button Configuration. For example, you can have the "Format" option set to PDF in Button Configuration. However, in Document Request you can choose from all possible options we have in Maven Documents.
In the "Document Title" field, you can write the name that the generated file would have. It may vary from the name of the template.
If the field is left empty, the generated file will have the same name as the template document used.
Using these fields, you can tailor access to the generated file according to your preferences and security policies.
Field | Shared with | Preview |
---|---|---|
Share User Edit List | Only specified users can edit, other users don't have document access | On OneDrive. |
Share User View List | Only specified users can view, other users don't have document access | On OneDrive. |
Create Shareable Edit Link | Anyone with the link can edit | In the Salesforce pop-up window. |
Create Shareable View Link | Anyone with the link can view | In the Salesforce pop-up window. |
This feature is available for PDF and DOCX file formats of the DOCX Document Template saved as OneDrive.
If you would like to store extra JSON metadata inside the generated file, you can use the "Embedded Data" field. Place the "JSON" snippet inside the text frame of the field and save the Document Request.
The structure of the embedded JSON is vital. For each "top-level" attribute in the "JSON snippet, we create one PDF custom field with the same name. The value of the field is the content of the respective JSON attribute.
Once the request is processed, the document is generated. Now, you can download this file to your device and open it with a specified app. Check document properties to have the embedded metadata in place.
For example, you would like to add issuer details, information about the document's validity, and the unique document ID. Compose JSON with that information and paste its content into the "Embedded Data" field.
{
"issuer":{
"id": "issuerId",
"type": "issuerType",
"location": {
"address": {
"countryCode": "Code of the country",
"fullAddress": {"City": "issuer city",
"street": "issuer street",
"building": "issuer building"}
}
}
},
"validFrom": "01.02.2025.",
"validUntil": "01.03.2025",
"DocumentId": "The ID value of the document"
}
After the document is generated and opened, here is how the metadata looks in the document properties:
This feature is available for PDF and DOCX file formats of the DOCX Document Template.
In the "PDF Conformance level" field, enter the value that represents the needed level.
These levels establish clear rules and standards for PDF files. They ensure that files are self-contained, compatible across all devices, and suitable for long-term preservation. The standards address elements such as fonts, color spaces, metadata, transparency, and other aspects of PDF creation and archiving. The goal is to guarantee consistent appearance and functionality, regardless of the system or software used to view the files.
If you leave the field untouched, the "PDFA3a" level is applied by default.
The "PDF Version" field defines the version of the PDF specification to which the PDF document conforms. In this field, put the value that represents the needed version.
If you leave the field untouched, the "PDF_1_7" version will be applied by default.
This feature is available for PDF file formats of the DOCX Document Template.
Maven Documents offers the ability to translate specific elements of the template. You can achieve it with the "Template Labels" feature. More information on how to use it can be found on the corresponding page.
In the "Language" field on the Document Request, you can determine the needed language value from the "Template Label" record. Once the request is completed, the generated file contains the translated labels in the selected language.
The "Locale" field enables the formatting of data—such as currency, numbers, dates, and times—in the generated document according to the standards of the specified country's locale. If no locale is specified, the system defaults to using the current user's locale settings. Here you can find more information on how to use the field. In most cases, the user's locale should be used to generate the document, so this field can be left empty.
If you would like to place the generated document in a specific folder on Drive you can define the path in the "Folder Path" field. You can check the "Document Templates" page to get more information on how to fulfill the field according to different template types.
In this field, you can use the ID of the needed folder on Drive or manually write the path to the destination folder with string values. You can also use merge fields to name the folders. In that case, after the generation process is over, the folder on OneDrive will have the name of the value from the used merge field.
ID of the folder can only be used for Google Templates and only at the beginning of the path. If you place it in the second position or later, the value is interpreted as a string, and the folder will be named after the ID value.
If the field is left empty, the generated file appears in the same folder as the template document.
There is a limit for Google: the maximum number of Document Requests that are processed in parallel within the last 15 minutes is 2 for Sandbox Orgs and 10 for Production Orgs.
These values count towards the limit:
For example, if you currently have 9 Document Request records with the "Processing" status, and 1 with the "New" status, you would have to wait until some of your documents have finished generating or for 15 minutes. You can create a new request only after one of these conditions is met.
There is a way to create more document requests than the limit. To do that, you can use the "Batch feature from" the "Setup Assistant" tab.
After running the batch, stop it by clicking the "Stop Batch" button, which is only available while the generation process is running. The generation process may take a while. After that, generated documents are available in the attachments section of every record where the document was generated.
There's also the "Action Requests" related list on the corresponding Document Request. The list holds the records of the executed Actions, showing their status.
The order in which Action Request appears in the list is determined by the "Order Of Execution" field on the "Action" Object.
The "Generate Document" Action is executed first, despite the set order. The only exception is when you are inserting Action Requests with the code where you can arrange the order differently.
After clicking on each Action Request, the associated record opens displaying the corresponding data.
Fields between the "Details" and "System Information" sections differ, depending on the selected Action. In the "Input" section, you can see the values that you've put in when creating the action. The "Output" section shows you the result values of the needed action.
In our example you can see the "Generate Document" Action which is always created by default when the document generation process takes place:
Here are the fields that the Document Request record contains, so you have a better idea of what it represents in the app:
Field API Name | Values / Type | Description |
---|---|---|
Name |
Auto Number |
The Action Request number. Automatically assigned by the app. |
Document_Request__c |
Lookup |
Lookup to the connected "Document Request" record. |
Status__c |
New , Processing , Completed , Error , Cancelled |
Current status of the record. |
Mandatory_Action__c |
Checkbox |
Signifies if the action is mandatory or not. |
Record_Type__c |
Record Type |
The type of the action the record stands for. |
Action__c |
Lookup |
Lookup to the corresponding action. |
Error |
Long Text Area |
Descriptive text containing an error message if such an error occurred. |
Other fields on a record duplicate fields and content from the connected "Action" record.
There are two ways of creating an Action Request:
Since using code is too technical and too advanced, let's focus on the first option.
First, note that the number of Action Requests associated with a Document Request corresponds to the number of Actions defined in its linked Document Solution. For example, if that Solution includes “Delete Google File” and “Email Autosend” actions, two separate Action Requests are created.
It means there should be three Action Requests related to the created Document Request:
In the "Actions" section, we mentioned the "Mandatory Action" checkbox. This checkbox affects the overall status of the Document Request. If you have multiple actions on Document Solution and one of them, marked as Mandatory, fails during document generation, the entire Document Request is marked as an "Error". Actions scheduled to follow the failed one are marked as "Cancelled", while those executed beforehand are marked as "Completed".
If the "Mandatory Action" checkbox is not marked, a failure in that specific action doesn't impact the "Document Request" status or the statuses of the subsequent Action Requests.
Each Document Request also holds the "Consumption" related list. It contains records with statistical data about the generated documents.
The data you see in the "Consumption" records depends on the following:
Depending on the type of the template document, different "dimensions" are evaluated for:
Currently, only Azure Document Templates support the "Consumption" functionality.
When the DOCX file is generated successfully without the "After Merge" preview, the "Consumption" records tell you the following information:
The definition of the generated document in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
The number of the generated pages in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
When the DOCX file is generated successfully with the "After Merge" preview, the "Consumption" records tell you the following information:
We described the essence of the "documents generated" and "pages generated" records above.
If the number of pages in the "After Merge" preview changes, it impacts only the "pages-managed" and "documents-managed" values. The "generated" records remain as they reflect the state of the initial document.
The definition of the managed document in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
If the number of pages in the "After Merge" preview changes, it impacts only the "pages-managed" and "documents-managed" values. The "generated" records remain as they reflect the state of the initial document.
The definition of the managed document in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
When the XLSX file is generated successfully without the "After Merge" preview, the "Consumption" records tell you the following information:
The number of the generated cells in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
The amount of generated sheets in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
When the XLSX file is generated successfully with the "After Merge" preview, the "Consumption" records tell you the following information:
We described the essence of "sheets generated" and "cells generated" records above.
If the number of cells in the "After Merge" preview changes, it impacts only the "cells-managed" value. The "generated" record remains as it reflects the state of the initial document.
The number of the managed cells in the "Consumption" record can be unique for each customer. Contact your administrator for more information.
If the number of sheets in the "After Merge" preview changes, it impacts only the "sheets-managed" value. The "generated" record remains as it reflects the state of the initial document.
The amount of managed sheets in the "Consumption" record can be unique for each customer. Contact your administrator for more information.