Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »


In order to make document templates flexible enough to be used for multiple cases, you need a way to automatically insert information from the case. SmartAdvocate provides you this power in the form of merge codes. A merge code is a unit of symbolic text that tells the SmartAdvocate system what piece of information should be inserted at that point in the document. When you generate a document for a specific case using a template that contains merge codes, SmartAdvocate reads those codes, finds the relevant information from that specific case, and makes the replacements for you. You will need the SmartAdvocate Word Plugin to take advantage of this feature for Word documents; a SmartAdvocate Excel Plugin is available for use in creating templates for Excel documents.

Generating Documents from Word or Excel Templates with Merge Codes

When the SmartAdvocate system generates a document with merge codes in it, it attempts to replace those merge codes with the appropriate information from the case in which the document is being generated. Some merge codes (e.g., the code for the case number) represent information that is unambiguous within a given case; there is only one possible replacement for that code. Other codes could have multiple possible replacements. For instance, a case might have multiple defendants, so if a template contained the merge code for the defendant's name, SmartAdvocate would not immediately know which defendant to replace the merge code with.


When you select a document to generate in the Create Documents screen for a particular case, a panel will open with, among other inputs, selection fields for any merge codes that the system cannot resolve on its own. These selection fields may be connected to each other. For example, if you have unresolved merge codes for the plaintiff's name and the plaintiff's address, they will both appear as selection fields in the panel. However, selecting the plaintiff will change the options available in the address field; only the addresses belonging to the selected plaintiff will be available. It is possible to use merge codes to insert one plaintiff's name and another plaintiff's address, if you need to do so; see Advanced Techniques for Using Merge Codes, below.


Once you have made your selections, the document will be generated, saved in the Documents section of that case, and opened in Word or Excel, as appropriate. If you have included any merge codes that require post-generation action (see Advanced Techniques for Using Merge Codes, below), Word or Excel will prompt you to take whatever actions are necessary to resolve the remaining merge codes. Once you have done so, save the document to make the code replacements permanent (otherwise, only the selections that happened before the document was generated will be saved).

Creating New Word or Excel Templates with Merge Codes

If you wish to create a new template, it is recommended that you start with an existing fully-formed example of the type of document you want to utilize to build a template. Click the SmartAdvocate tab in the top tool bar in Word or Excel to open the merge code and template options.

For each piece of text in the document that contains information that would be part of the SmartAdvocate case file, perform the following steps:

  • Highlight (select) the text.
  • Look through the merge codes visible in the top tool bar (commonly used merge codes) to see if one of them represents the information in the selected text. (For example, if the text is the full name of the plaintiff in the case, you would be looking for the "Name" code in the Plaintiff Merge Codes section of the top tool bar.)
  • If you did not find the merge code in the top tool bar, click Merge Codes in the Insert section of the top tool bar. This will bring up a list of all the merge codes in the system.
  • Find the merge code that represents the information in the selected text. To make it easier to find your merge code, you can try choosing the code type from the dropdown above the list and/or use the filter row at the top of the list to narrow down the visible codes. When you have found it, click Insert Selected Merge Code and Hide Dialog to replace the text with the code and close the list.

For any information that would not necessarily be part of the SmartAdvocate case file, but which might vary between different documents created from that template (e.g. the type of document being served in a template of an affidavit of service), you can use a post-generation prompt. Click the Prompt icon in the Insert section of the top tool bar to create a prompt, then replace "Message Text" with a description of the information you want to insert at that point. After the document is generated, Word or Excel will prompt you with the description you used and a text input field that you will fill in with the text you wish to insert at that point. (You can also replace "Default Value" with any text you want to be in the input field by default; if you choose not to, the input field will simply be blank by default.)


You can also include the current date and/or time by selecting Date and Time from the Insert section of the top tool bar. Doing so will bring up a list of possible formats to insert. Select the one you wish to include in the template, then click Insert Selected Date. Click the red X in the upper right corner of the list to close it.
When you have made all the text substitutions you need, click Save As in the Template section of the top tool bar.

(NOTE: Only use the Save As button within the SmartAdvocate tab to save a template. Using the standard Save button in Word will save what you are working on as a document in Word, rather than a template in SmartAdvocate.)


This will bring up a panel where you can name the template and select its category and subcategory. You can also put it in a template group, but since template groups already automatically include templates based on their names, this is generally unnecessary unless you want to put the template in a group other than the ones its name would already put it in. See the Document Templates administrative page for details. There is also a checkbox you can select which will mark the template as archived, but all that does is make the template unavailable for use in generating documents, so you probably should avoid doing so when initially creating a template. Once you click Save As in the panel, the template will be saved in the SmartAdvocate system and (if it is not archived) can be used to generate documents for any case.

Styling Merge Code Text

If you want to control the way the text that replaces a merge code in a generated document looks, simply format the merge code itself to the way you wish the text be formatted. If you want it to be italicized, or a larger size, or a different color, make those changes to the merge code and the replacement text will have the same changes. You cannot cause only part of the replacement text to have some format; the entire replacement text will always have the same format. (Two different pieces of text that are the result of two different merge codes can be formatted differently.) In particular, if you want the replacement text to appear in all capitals, select the merge code, open the Font panel in Word or Excel, then select "All caps" from the Effects section.

Advanced Techniques for Using Merge Codes

There are several additional tools that merge codes offer that are available through the use of suffixes. A merge code suffix is text, enclosed in angle brackets (< >), appended to the main merge code, within the square brackets ([ ]), with a comma. For example, <! [PL-AGE,<Youngest Plaintiff>] !> would be a merge code with a suffix, and <Youngest Plaintiff> would be the suffix. Suffixes can serve a number of purposes. Suffixes have no effect if the merge code represents unambiguous information; the merge code is replaced during document generation without any prompts. However, if the merge code with a suffix represents information that might be ambiguous, it is not replaced at the time the document is generated; instead, it either triggers a prompt in Word or Excel that asks the user to select the appropriate option once the document is generated, or it is automatically replaced after the document is generated based on similar selections earlier in the document. There are four main types of suffixes:

  • An asterisk suffix. This is any suffix where the first character after the opening angle bracket is an asterisk, such as <*Example>. Merge codes with an asterisk suffix always trigger a prompt, the title of which is whatever text follows the asterisk (possibly none). You can either type in an asterisk suffix manually, or, if you are selecting the merge code from the full list, you can select the Force User Input option below the list and write the title of the prompt (if any) in the Question field.
  • A hash suffix. This is any suffix where the first character after the opening angle bracket is a hash symbol, such as <#Example>. Merge codes with a hash suffix always trigger a prompt, the title of which is whatever text follows the hash symbol (possibly none). Additionally, merge codes with a hash suffix allow the user to select multiple options and gives the user a choice as to the text that will separate them (e.g. a comma and space, or a new line) when they are substituted in for the merge code. You can either type in a hash suffix manually, or, if you are selecting the merge code from the full list, you can select the Multiple Select option below the list and write the title of the prompt (if any) that will appear in the Question field.
  • A standard suffix. This is any suffix where the first non-space character after the opening angle bracket is neither an asterisk nor a hash symbol, such as <Example>. Merge codes with a standard suffix only trigger a prompt if there has not already been a merge code with the same suffix, requiring the same selection, earlier in the document. For example, if the first two merge codes in a document are <! [PL-FIRST-NAME,<Lead Plaintiff>] !> and 

Create and Use UDF Merge Codes

  1. First create the UDF using UDF Editor and give the UDF a “Short Name” (The Short Name will become the UDF Merge Code)

2. When creating your template, select “Dynamic Merge Code” to choose the UDF merge Code

3. Choose the type of UDF from the list on the top section of the list of Dynamic Merge Codes (e.g., Case UDF, etc.)


4. You will see your UDF Merge Code that was created in Step 1 above.


5. From here the UDF Merge code is inserted in your template the same way as any ‘regular’ merge code.






  • No labels