Create a Contract Template in Salesforce with Dochly
What is a Salesforce contract template?
A Salesforce contract template in Dochly is a reusable contract structure stored natively inside Salesforce. It defines every section of your contract — parties, term, scope, commercial terms, legal clauses, and signatures — and populates the dynamic fields automatically from the Opportunity, Account, or Contract record it's generated from.
Unlike a static Word contract that someone updates manually for each deal, a Dochly contract template is connected directly to your CRM data. Generate it once from the right record and every field is accurate — no transcription errors, no outdated pricing, no wrong party names.
Party details from Salesforce
Customer name, address, contact — pulled from Account and Contact records. Your company details are static in the template.
Conditional legal clauses
Liability caps, jurisdiction, payment terms, SLA levels — shown or hidden based on deal type, region, or contract value.
Native e-signature blocks
Both-party signature fields connected to Dochly's native e-signature — no DocuSign, no external platform required.
Triggered by automation
Generate on Opportunity close, approval completion, or stage change — no manual action required from sales or legal.
Audit trail on the record
Every generation, send, open, and signing event logged natively on the Salesforce record — no external dashboard needed.
Stored as Salesforce Files
Signed contracts attach automatically to the originating Opportunity or Contract record — instantly accessible, never lost.
Contract types you can build
The same template creation process works for any contract type. The difference is the primary Salesforce object you select and which conditional clauses you include.
Long-form governing agreement covering the entire customer relationship. Usually generated from the Account object. Includes liability, IP, confidentiality, and dispute resolution clauses.
Deal-specific contract generated from an Opportunity. Includes scope, pricing, payment terms, and delivery schedule pulled directly from Opportunity and line item data.
Shorter, simpler contract. Generated from Account or Contact records. Mutual or one-way versions handled by conditional logic — one template covers both.
Project-specific agreement generated from an Opportunity. Includes dynamic deliverables table, milestone schedule, and acceptance criteria — often from Opportunity Products.
Generated from a Contract object nearing renewal date. Pulls existing term, pricing, and scope for review — with updated effective dates and any amended terms.
Generated from Account records with Type = Vendor. Includes purchasing terms, delivery requirements, and compliance obligations — different clause set from customer-facing contracts.
Before you build
Contract templates require more preparation than other document types. Before opening the editor, confirm these four things are in place:
Have your legal team review and approve the contract language before building it into the template. Once published, every generated contract uses this language — making it critical to get it right upfront.
Confirm all fields your contract needs are present and consistently populated on your Opportunity and Account records. Empty fields generate blank sections — which is worse in a contract than almost any other document type.
List every variation your contract needs to handle — enterprise vs SMB terms, UK vs US jurisdiction, payment terms by deal type. Each variation becomes a conditional block in the template.
Know exactly who signs on each side — customer contact, internal approver, legal representative. This determines how many signature blocks you need and what signing order to configure.
100% native Salesforce contract generation & e-signature
Step-by-step: building your contract template
Create and name the template
Open the Dochly app in Salesforce. Go to Templates → New Template. Use a clear naming convention — for example "Sales Contract — Enterprise" or "NDA — Mutual". Select the primary object — Opportunity for deal-specific contracts, Account for relationship-level agreements, or Contract for renewal workflows.
See the foundational guide: Create a document template in Salesforce with Dochly
Build the contract header
Add your company logo, document title ("SERVICE AGREEMENT", "NON-DISCLOSURE AGREEMENT"), and a reference block in the top-right corner. Contract reference details to include:
Date: {{TODAY | date: "MMMM d, yyyy"}}
Version: 1.0
For logo and brand formatting: Build a branded document template
Build the parties section
The parties section identifies both contracting entities. Your company information is static; the customer information pulls from Salesforce:
[Your Company Name], a company incorporated under the laws of
[Your Jurisdiction], with its principal place of business at
[Your Address] ("Company")
AND
{{Account.Name}}, with its principal place of business at
{{Account.BillingStreet}}, {{Account.BillingCity}}, {{Account.BillingCountry}} ("Customer")
Add effective date and contract term
Contract dates are critical — a blank or incorrect date is a serious contract error. Pull the effective date from the Opportunity and calculate the end date using a formula field or a custom date field:
Initial Term: {{Opportunity.Contract_Term__c}} months
Expiration Date: {{Opportunity.Contract_End_Date__c | date: "MMMM d, yyyy"}}
If these custom fields don't exist in your org, work with your Salesforce admin to add them before building this section. See adding merge fields for custom field syntax.
Add scope of services section
Define what is being delivered under the contract. For product-based contracts, use a dynamic table pulling from Opportunity Products. For service-based contracts, use a combination of static language and merge fields:
{REPEAT OpportunityLineItems}
• {{OpportunityLineItem.Name}}: {{OpportunityLineItem.Description}}
{END REPEAT}
Add commercial terms section
The commercial terms section covers fees, payment schedule, and billing. Pull values directly from the Opportunity to ensure accuracy:
Payment Terms: {{Opportunity.Payment_Terms__c}}
Billing Frequency: {{Opportunity.Billing_Frequency__c}}
Currency: {{Opportunity.CurrencyIsoCode}}
Add conditional clauses
Conditional logic is essential in contract templates — different deal types, deal sizes, regions, and customer segments require different legal terms. This is how one master contract template handles multiple variations:
[Enterprise liability cap and indemnification terms]
{ELSE}
[Standard liability terms]
{END IF}
{IF Account.BillingCountry = "United Kingdom"}
[English law and jurisdiction clause]
{ELSE IF Account.BillingCountry = "Germany"}
[German law and jurisdiction clause]
{ELSE}
[Default jurisdiction clause]
{END IF}
{IF Opportunity.Type = "Renewal"}
[Renewal-specific amendment and continuity clause]
{END IF}
Add standard legal clauses
These are static clauses that appear in every contract regardless of deal type. Work with your legal team to finalize the exact language before inserting into the template:
Non-disclosure obligations for both parties covering information exchanged during the contract term.
Ownership of deliverables, background IP, and any license grants between the parties.
Grounds for termination for cause and for convenience, notice periods, and obligations on termination.
Cap on each party's total liability and exclusions for consequential or indirect damages.
Confirmation that this document supersedes all prior agreements, representations, and understandings.
Requirement for amendments to be in writing and signed by both parties to be effective.
Add the signature block
The signature block must include fields for all required signatories — customer-side and company-side. When connected to Dochly's native e-signature, these become interactive digital signature fields:
Signature: ________________________ Date: ____________
Name: {{Contact.FirstName}} {{Contact.LastName}}
Title: {{Contact.Title}}
For and on behalf of [Your Company Name]:
Signature: ________________________ Date: ____________
Name: {{Opportunity.Owner.Name}}
Title: {{Opportunity.Owner.Title}}
Preview, test, and publish
Before publishing, test the contract template thoroughly from multiple real Opportunity records — especially records that trigger different conditional clause branches. Check every merge field, every conditional section, and the signature block formatting.
Test these scenarios specifically:
- An Opportunity over your liability cap threshold (triggers enterprise clauses)
- An Opportunity from a UK or EU account (triggers jurisdiction clauses)
- An Opportunity with a Renewal type (triggers amendment clause)
- An Opportunity with missing optional fields (no blank "null" text appears)
For troubleshooting output issues: Template editor troubleshooting guide
Connecting your contract template to e-signature
Once your contract template is published, connect it to Dochly's native e-signature so the signing workflow runs entirely inside Salesforce — no external platforms, no manual download and re-upload.
Button click or automated Flow trigger generates the contract from live Salesforce data and attaches it to the Opportunity record.
The primary contact on the Opportunity receives a secure signing link via email — no external account required to sign.
After the customer signs, the internal signatory receives the document for counter-signature — sequential signing order configured in Salesforce.
The completed, dual-signed contract with full audit trail is stored as a Salesforce File on the Opportunity record automatically. Opportunity stage updates.
For multi-signer contracts requiring parallel or sequential signing — for example, customer signs first, then legal counter-signs — configure signing order directly in Salesforce using the same declarative tools you already know.
Connecting to an approval workflow
For contracts that require internal legal or management review before being sent to the customer, connect contract generation to a Salesforce approval process. This ensures no contract leaves the org without the appropriate sign-off.
Set document generation as the final approved action — the contract is generated and sent for customer signature only after the last internal approver grants approval.
Build a Flow that triggers contract generation when the Opportunity stage reaches "Contract Ready" or a custom approval checkbox is checked by the reviewing manager.
Contract template best practices
- Get legal sign-off before publishing — have your legal team approve all contract language before the template goes live. Treat a published template as a signed-off document, not a draft.
- Use conditional logic aggressively — one master contract template with conditional clauses is better than maintaining ten separate templates. It reduces errors and makes legal updates faster.
- Version every update — when legal terms change, create a new template version rather than overwriting. You need to know which version generated which historical contract. See editing and updating templates.
- Restrict who can edit the template — contract templates contain legal language that should only be modified with legal oversight. Use Salesforce permission sets to restrict template editing access.
- Require all date fields before generation — add a Salesforce validation rule or Flow check to ensure Contract_Start_Date__c and Contract_End_Date__c are populated before a contract can be generated.
- Test the signing experience on mobile — many contract signers are executives who sign on their phone. Verify the e-signature experience is smooth on iOS and Android before going live.
Frequently asked questions
Your contract template is ready to generate accurate, legally structured contracts in one click from any Salesforce Opportunity. Next steps: Create an invoice template · Edit and update an existing template · Troubleshooting guide
Rated 5 stars · Native Salesforce app · Free to install