Introduction
Automating contract generation in Salesforce saves time and reduces errors. Savvy DocGen integrates with Salesforce to generate documents directly from your records. This article explains how to set up automated contract generation using Savvy DocGen, from template creation to workflow automation.
Step 1: Prepare Your Contract Template
The first step is to create a contract template that Savvy DocGen can use to generate documents. The template should be a Microsoft Word document (.docx) formatted with placeholders for Salesforce data fields.
Use Merge Fields
Use merge fields in the template to indicate where Salesforce data should be inserted. The syntax for placeholders is {{ObjectName.FieldName}}. For example, {{Account.Name}} inserts the account name.
Example Placeholder Usage
Contract between {{Account.Name}} and Our Company
Effective Date: {{Contract.EffectiveDate}}
Amount: {{Contract.Amount}}
Step 2: Upload the Template to Savvy DocGen
Once your template is ready, upload it to Savvy DocGen within Salesforce:
- Navigate to the Savvy DocGen app.
- Select Templates and click New Template.
- Upload your .docx file and assign a name.
- Specify the primary Salesforce object related to the template (e.g., Contract).
- Save the template.
Step 3: Map Salesforce Data Fields
Verify that the fields in your template match the Salesforce object fields. Savvy DocGen automatically scans your template for merge fields and lists them for review.
- If a field is missing or incorrect, adjust the placeholder in your template and re-upload.
- Ensure custom fields are included with the correct API names.
Step 4: Create a Document Generation Job
To automate document generation, create a job that uses your template and defines the data source.
- Go to Document Jobs in Savvy DocGen.
- Click New Job and select your template.
- Set the object and filter criteria for which records to generate documents.
- Choose output options such as PDF generation and storage location (e.g., Salesforce Files, email attachments).
- Save the job.
Step 5: Automate Document Generation Using Salesforce Flows
To generate contracts automatically, use Salesforce Flow to trigger Savvy DocGen jobs when specific events occur.
Create a Record-Triggered Flow
- In Salesforce Setup, go to Flows and create a new Record-Triggered Flow.
- Set the trigger object (e.g., Contract) and specify conditions (e.g., status changes to "Approved").
- Add an action to call the Savvy DocGen job using the
Generate Document invocable action.
- Pass the triggering record ID to the action.
- Activate the flow.
Step 6: Test the Automation
Create or update a record that meets your flow criteria to verify that the contract document generates automatically. Check the generated document in the specified storage location or email.
Additional Tips
- Use conditional merge fields in templates to handle optional data.
- Set up error handling in flows to capture and log generation failures.
- Schedule batch jobs in Savvy DocGen for mass document generation.
Conclusion
Automating contract generation in Salesforce with Savvy DocGen involves creating a Word template with merge fields, uploading it, setting up data mapping, and creating automation flows. Following these steps reduces manual work and ensures consistent, accurate contract documents.
In the next article, we will cover advanced template features like conditional logic and table merging.
Read next