CRM Field Integration
Learn how to integrate sajn document fields with your CRM system, enabling you to create documents with editable fields, store field references, and update content directly from your CRM.Overview
This guide covers a common integration pattern where you:- Create a document with fields - Add TEXT or FORM fields to a document
- Store field references in your CRM - Save field IDs or keys for later access
- Update fields from your CRM - Sync changes back to sajn when CRM data changes
- Contracts that pull customer data from your CRM
- Proposals with pricing that updates based on CRM deals
- Agreements with terms that vary per customer record
Understanding Field Identifiers
sajn provides two ways to reference fields when updating:Field ID
A unique identifier returned when creating a field. Use this when you need to reference specific field instances.Field Key
A custom identifier you assign when creating a field. Use this for a more readable, semantic approach.Field keys must match the pattern
^[a-z0-9_-]*$ (lowercase letters, numbers, underscores, and hyphens only).Step 1: Create Document with Fields
Create the Document
First, create a document that will contain your fields:Use
externalId to store your CRM record ID. This makes it easy to find the sajn document from your CRM later.Add TEXT Fields
TEXT fields contain rich text content that you can update programmatically:Add FORM Fields
FORM fields contain input elements that signers can fill out, or that you can pre-fill:Step 2: Store Field References in Your CRM
After creating fields, store the references in your CRM so you can update them later.Recommended Data Model
Why Use Keys Instead of IDs?
Using field keys (likecustomer-name) instead of field IDs (like field_abc123) offers advantages:
| Approach | Pros | Cons |
|---|---|---|
| Field Keys | Readable, no storage needed, survives document recreation | Must define keys when creating fields |
| Field IDs | Works with any field, including those without keys | Must store IDs, IDs change if document is recreated |
We recommend using field keys for most integrations. They’re more maintainable and you don’t need to store additional IDs in your CRM.
Step 3: Update Fields from Your CRM
When data changes in your CRM, update the corresponding sajn fields.Update TEXT Fields
Update text content using the field key:Update FORM Fields
Update form input values using the subfield key:Batch Update Multiple Fields
Update all CRM-mapped fields at once:Complete Integration Example
Here’s a complete example of a CRM integration service:Best Practices
Always check document status before updating
Always check document status before updating
Fields can only be updated when the document is in
DRAFT status. Check the status before attempting updates to provide better error messages to your users.Use webhooks for two-way sync
Use webhooks for two-way sync
Set up webhooks to receive notifications when documents are signed or updated. This enables you to update your CRM when document status changes.See the Webhooks Guide for setup instructions.
Handle errors gracefully
Handle errors gracefully
Individual field updates may fail while others succeed. Handle errors per-field rather than failing the entire sync.
Use meaningful field keys
Use meaningful field keys
Choose descriptive field keys that match your CRM field names. This makes debugging and maintenance easier.
Troubleshooting
Field Not Found Error
Cannot Update Field - Document Not in Draft
Invalid Field Value
YYYY-MM-DD, numbers should be strings.
Next Steps
Create Documents
Learn more about document creation options
Templates and Forms
Use templates for consistent document structure
Webhooks
Set up webhooks for two-way CRM sync
Document Fields API
Full API reference for field operations

