Legalsense can generate Word documents (such as letters) directly from a matter, using templates that pull in matter and contact details automatically. This article explains how template management works, how to set up the merge fields in a template, and lists the field codes you can use.
Legalsense fills a template's fields with the relevant matter, client, and contact data when you generate a document. Once you generate the document, Legalsense offers it as a download in your browser. From that point on, there is no further link between the document and the matter in Legalsense.
In this article
Template management
Template management isn't available by default. Contact Legalsense to have it set up. Legalsense activates the feature document_word and adds the permit manage_word_templates to the Admin permission group. Only Legalsense can do this step. After that, users in the Admin permission group can add and manage templates themselves.
Once enabled, find your templates at Settings → Lists → Word templates. It's the last item in the list, which is sorted alphabetically.
The overview of existing word templates.
Adding a new template
To add your own Word template:
- Go to Settings → Lists → Word templates.
- Click New template.
- Choose the file and enter a name for the template. If you leave the name field blank, Legalsense uses the file name as the template name. Legalsense only accepts files with the .docx extension.
- Click Save.
Renaming or replacing a template
Click the edit icon next to a template to rename it or upload a new file to replace it.
Edit Word template page, showing the fields to rename a template or replace its file.
Note: If you upload an updated version of an existing template, give it a different name than the template currently stored, for example by adding v2. Legalsense doesn't accept the same name.
Setting up Word files and templates
A Legalsense template is an ordinary Microsoft Word file into which you insert fields that correspond to Legalsense's data model. Legalsense populates these fields with data from the system when generating a document. The fields are Word MergeField fields. Legalsense can provide a sample letter containing a number of these fields, which you can use as a reference for how to notate them.
Adding a merge field in Word
- In Word, go to Insert → Field and select MergeField. Word inserts a field that shows an error, because it doesn't have a field name yet.
- Right-click the field and select Toggle Field Codes. Word now shows the field code, for example:
{ MERGEFIELD \* MERGEFORMAT } - Type the Legalsense field name directly after
MERGEFIELD, before the\*. For example:{ MERGEFIELD matter.name \* MERGEFORMAT } - Right-click the field and select Toggle Field Codes again to return to the normal view.
See Field names and Available merge fields by category below for the field names you can use.
Note: You can't copy the curly brackets from this article into Word. Word only recognizes a field if it inserts the brackets itself.
Note: If you're converting an existing document, Word's own tools, such as Find and Replace, can help you replace placeholder text with the matching merge fields.
Field names
Because a template can pull in almost any data stored at contact, client, or matter level, the list of possible field names is extensive. You can also have additional fields added to Legalsense for use in your templates.
A short list of commonly used field names:
- Your reference:
their_reference - Shipping mode:
mailing_option - Salutation (contact):
salutation - Fax number (contact):
fax - Email address (contact):
email - Date the document was created:
date_created - Full address:
address_label
Sender
All information about the sender is available (see Names below for name fields), for example sender.function and sender.email.
Note: Legalsense must first create additional custom fields, such as personal phone numbers, before you can use them in a template.
Client / matter / contact
- Matter name:
matter.name - Matter display name (as matters are displayed elsewhere in Legalsense):
matter - Matter number:
matter.format_number - Practice area:
matter.practice_area - Matter type:
matter.matter_type - Client:
matter.client - Client number:
matter.client.format_number - Court roll number:
matter.docket_number - Court reference:
matter.court_reference_number - Legal aid number:
matter.legal_aid_number - Name of contact:
contact - First name of selected contact:
contact_person.first_name - Last name of selected contact:
contact_person.get_last_name - Full name of selected contact:
contact_person.get_full_name
Names
- Sender full name (e.g. Donald Johnson):
sender.userprofile.get_name - Sender last name, including prefix (e.g. Rex Van de Camp):
sender.userprofile.get_full_last_name - Sender name with initials (e.g. D. Johnson):
sender.userprofile.get_initials_name - Sender last name first (e.g. Johnson, Donald):
sender.userprofile.get_name_phonebook_notation - Sender initials (e.g. D.J.):
sender.userprofile.initials - Sender abbreviation:
user.userprofile.get_abbreviation
This same notation also applies to rendering the names of other Legalsense users. For example, the matter supervisor's name:
matter.get_supervising_user.userprofile.get_name
Or the name of the user who generates the document (the logged-in user):
user.userprofile.get_name
Available merge fields by category
The tables below list merge fields you can use in your templates, grouped by the data they pull in. In Word, a merge field is displayed between guillemets, for example «matter.name».
Contact fields
Contact person fields
User (sender) fields
Note: The phone number fields are custom fields. Legalsense must set them up for your firm before you can use them.
Matter supervisor fields
Matter fields
Conditional logic
Microsoft Word lets you add logic to a field, for example showing a label before or after a field's value only when that field actually contains data. Consider a field that displays "By fax: 020 345 34000": in that case, it's convenient to have "By fax:" appear only when a fax number is actually available.
Testing a template
Once your template is ready for testing, upload it as described in Adding a new template. Then:
- Go to a matter and click New document.
- Select the template you just uploaded.
- Open the generated document and go through all the fields. Check that each field shows the information from Legalsense you intended.
If a field is empty or shows the wrong data, check the field name in Word, upload the corrected file under a new name, and test again.
Other options
If you need more advanced document generation, other parties also offer solutions for this. For example, Documentaal works together with DMS for Legal from Epona. It uses the Legalsense API to retrieve the information it needs to fill in documents in its own system.
Comments
0 comments
Please sign in to leave a comment.