One more way to automate business processes is to add Actions to the Document Solution. These Actions automatically happen after you generate a new document.
Note: It is important to remember that if you use Google Docs or Google Sheets as the Document Template type then all Actions will be available. But if you use DOCX or XLSX file types then you can create Field Update, Email Autosend, and Email Preview Actions.
In order to create a new Action follow the steps:
After you click the New button, the modal with the list of available Actions will open. You can choose only one Action and after that click Next to continue.
The Action updates the field on the related Object after you generate the document.
The following information is needed to set the up Action:
In the example from the screenshot below, after the Action is triggered, Stage Name on the selected Opportunity will be changed to Proposal/Price Quote.
Some things for you to note:
1. If you would like to save the ID of the generated Google Doc or Sheet in your Salesforce field, please enter the following expression in the Value field:{!Document_Request__c.External_File_Id__c}
. Using the same approach you can save any value from the Document Request record.
2. Generated DOCX and XLSX files don't have such a field populated in Document Request, so instead you can save the ID of the generated file in the Salesforce field, using the following expression in the Value field:{!Document_Request__c.File_Id__c}
.
If you are planning to have more than one Action on the Document Solution, you can execute them in a certain order by using the Order Of Execution field. Place the needed values in the field on each Action and they will be executed in that order. If you leave the field empty, the default value will be assigned to the corresponding Action.
You can notice that the Mandatory Action checkbox is marked by default. It means, that the end result of the Action influences the next Actions in the queue. So if the Action fails, others will stay in the Cancelled status. But if the checkbox is unmarked, the failure of the Action won't affect the execution of the following Actions.
All the created Actions and their field values are exported and imported alongside the Document Solution.
If you want the Google Docs file to be deleted from Google Drive right after the generation process is over, you can use the Delete Google File Action.
Just select the corresponding Document Solution and click Save. Yes, as easy as that.
Order of Execution and Mandatory Action fields have the same functionality as was explained in the first Action.
This Action allows you to send the email with the generated document as an attachment.
Email Autosend Action has the following attributes to specify:
Order of Execution and Mandatory Action fields have the same functionality as was explained in the first Action.
To Email Address, Cc Email Address, and Bcc Email Address can accept multiple addresses or IDs separated with a semicolon (
;
). Also, if you would like to dynamically get recipients from the original record, you can use expressions in the following format{!Record.Field__c}
where Field__c is the name of the field where the recipient email or ID is stored. For example, the To Email Address field can beoffice@mavenmule.com;{!Record.OwnerId};{!Record.Primary_Contact_Email__c}
.
For the Email Preview Action to work properly, make sure that the Activity component is open on the record where you generate the document.
With the Spring '23 Release, Salesforce introduced the Dynamic Activity Composer (DAC), which changed the way the Activity tab on Salesforce records behaves.
Currently, the Email Preview Action doesn't work with DAC. So you need to switch back to the Tabbed Activity View to have the Action available:
1. Click Edit Page in the Setup menu.
2. Select the Activities component.
3. In the Properties panel, check the Use tabbed activity view checkbox.
4. Save changes.
This Action is similar to the Email Autosend Action with the difference that you have the option to review an email before sending it to the customer.
When the document generation process is over, email fields will be populated with the data you define while setting up the Action. The generated document will be automatically attached to the email as well. Review the email or adjust it and then simply send it. The form for the Email Preview Action is identical to Email Autosend.
Order of Execution and Mandatory Action fields have the same functionality as was explained in the first Action.
The generated Google Doc or Google Sheet will be saved in the same folder as the template Google file. You could end up in a situation where your Google Drive folder is full of generated documents and you could find this a bit disorganized. This is where the Move Google File Action becomes useful. Using this Action you can move your newly created Google Doc or Google Sheet to the existing folder. That is not all! The Action can also create subfolders to keep your Google Drive completely organized and tidy.
There are the following fields to be filled in while creating the Action:
Month__c
and Year__c
that will contain the month and year in which the Opportunity is created. After our document is generated, Maven Documents will automatically create new folders in the root folder and it will place the Google Doc into the created folder.In the image below, Maven Documents has automatically created two new folders: 2023
and 12
. You don't need to worry about duplicate folders, Maven Documents will make sure it reuses already existing folders.
If you want to create multiple subfolders, split them with
/
. For folder names, you can use either static text or you can use dynamic expressions like in our example.
Order of Execution and Mandatory Action fields have the same functionality as was explained in the first Action.
All the new Google Drive files that are generated with Maven Documents will be initially owned by the Admin user that was used to connect to your Google Drive. More information can be found in the Administration article.
If you are using Google Docs or Google Sheets as the output format and you would like to share the generated Google file with another person, let's say a customer, then use the Share Google File Action.
The Share Google File Action provides the following options:
Document Solution - predefined with the name of the Document Solution you are working on. This information is mandatory.
Share Type - defines the type of the grantee that will get access to the Google Drive file. This information is mandatory.
Share Role - defines the role granted to the grantee. This information is mandatory.
You should also know, that if you own the document, you can't share the ownership with another User. In that case, the Action Request will end up in an error.
Email Address - the email address of the grantee. This field should be populated only when the selected Type is User or Group.
Send Notification Email - if checked, after the document is generated and shared with the grantee, a notification email will be sent to the grantee as if you are sharing your document manually. This field can be checked only when the selected Type is User or Group.
Domain URL - the domain to which this sharing refers. This field should be populated only when the selected Type is Domain.
The Email Address field supports dynamic expressions as displayed in the screenshot above.
Keep in mind: if you would like to share the file with multiple grantees, create multiple Actions on the same Document Solution.
Order of Execution and Mandatory Action fields have the same functionality as was explained in the first Action.
As you can say from its name, with the help of this action you can copy the file that was generated and stored at OneDrive or Google Drive, and place it on the needed record on Salesforce. To accomplish that, you would need an ID of the destination record, the type of the Drive, and the ID of the desired file.
As additional features, you would be able to change the name of the file and define the format, either PDF or DOCX, and how the file is saved on Salesforce: as a file or an attachment.
Currently, the Copy Document Action only supports Microsoft OneDrive DOCX files.
However, this action stands out from the ones we described above.
First of all, you won't find it in the list of available actions on a Document Solution. This action is only available in a Flow.
Secondly, it is not a post-generation action. That means, you can execute the Copy Document to Salesforce actions regardless of whether the document was generated or this is not even in the picture. But of course, you can embed this action in the document-generating Flow and use data from the Flow elements to create a process that suits your business logic most.
We wrote instructions to use the action both alone and as a part of the Flow. Follow the link to check it out.
This Action allows you to merge two or more separate PDF files into one. You can merge the generated PDF file with PDFs that were generated earlier or uploaded to your Salesforce org. Or you can join separate PDFs into one without generating the template.
All the PDF files that you want to merge should be preliminarily uploaded to Salesforce.
This Action is slightly different. As you could've noticed, this one is not on the list of available Actions. You can call it from the Flow or by inserting it with the code via the Developer Console.
We would say that using code is too technical, so you can check the article where we describe how to build the needed Flow and use the Merge Files Action there.