To create an automation template for document generation with Contract Express, you need to choose a Word document which contains the text of the document and add automation logic to it. All automation logic in Contract Express is added to the template document as a field or a span.
Field
is an insert point in the document where the dynamic information will be inserted, for example, you want to insert the names of the parties, the dates, the product names or amounts. Most commonly the information for these inserts is collected by asking questions on the questionnaire. However, it is also possible to use computations where the value of the insert is calculated based on other answers or to insert information from an external data source.
Span
is conditional logic applied to the document text which can cover one or multiple paragraphs or just a couple of words or even letters. The most common span type is the show/hide span where the text inside the span is only included in the document if the condition specified for this span is satisfied and hidden if it is not. Another useful span type is repeat pans where some information in the contract must be repeated for multiple entities or units. For example, if your contract may have one or more tenants, you will repeat the section of the document which lists their names and details.
When you define the field or span in the template, you will use variables to specify the kind of data that is needed for the insert or to determine the conditionality.
Variable
is a data container for the dynamic data which will be collected for each generated document. Think of each question in the questionnaire as a variable which collects the answer to insert it into the document or to drive the conditional logic of a span.
Note that the same answer (for example, the company name relevant for a contract) can appear in the document multiple times therefore the same variable is often used in multiple fields or spans. Use the Markup tab to create an automation template by adding fields and spans to your document. As you add fields and spans, you will also define variables which will then appear as questions in the questionnaire when your end users generate a document.
Navigation of the Markup
The Markup tab in the new Contract Express Author add-in is designed to respond to your clicks within the document.
If you click outside of content control, the work pane will show options to insert a field, or insert a span, along with the main markup home. When you click on a specific content control, the work pane will switch to display the details of that particular markup, also indicating whether it is a field or a span. If you click outside of the content control, the work pane will return to the home screen, offering options to add new markup. This allows for easy navigation between views—whether you are working within a content control or adding new elements.
Remember that while there are differences between Word Online and Word Desktop in what is highlighted for a single and double click on the content control lozenge, placing your cursor between the lozenges always displays the current markup in the work pane. For more info on the clicking behavior, read
General Guide.
Run AI Markup Suggestions
When you start working on a new template, we recommend using AI-powered markup suggestions to identify the fields automatically and create variables for them. In a matter of minutes, you will have the first draft of your template ready for review. This feature can be run on filled-in documents or model documents which already have some placeholders for the dynamic elements.
Once you select "Suggest Markup" in the bottom right of the page, the system will display a summary screen showing how many fields and variables have been detected.
The 'Suggest Markup' feature does not work with pre-marked documents and requires Advanced AI features which can be enabled in the admin tab of your Contract Express account.
On this screen, you can choose to Accept all or Reject all or can click "Start Review" to begin the review process to inspect each suggestion one by one. Remember that you can always return to the summary screen on the Markup hope page by clicking outside of content controls in your document.
During the review, accept fields which have been inserted in the correct placed and reject the ones that should not be marked up as fields. Review the datatype and question of the proposed variable and adjust them as needed before accepting. You can also replace the variable with another existing variable or create a new variable with a different name if the field is placed in the correct position, but you do not agree with the suggested variable.
If you have accepted a field but you change your mind later, you can always click on the markup content control in the document to return to it in the work pane. Click between the lozenges, review the variable details and update as needed or click on the delete icon to remove it from the document. Once review is complete, review the template to see if it needs any additional fields or spans which can be added manually.
To insert a field, highlight the text which will be replaced or place the cursor in the relevant position, then select Insert field. Content control will be inserted into the document and the work pane will present the Variable selection screen. Type the variable name to create a new variable or find one in the list of the existing variables. Set the type and question and click apply.
A field which contains a variable name as its definition is the simplest and most common type of field. It inserts the answer from the questionnaire into the document exactly as the answer is provided and stored. In some cases, you will want to manipulate the value using functions or format it in a special way. This is possible in the advanced mode which is described later in this article.
When you work with a new field, you have the option to undo the insertion of the field to revert to the original text. It is also possible to delete the field by clicking on the delete icon at the bottom of the screen. Note that deletion will remove the content control, but it will not reinstate the text it replaced when it was first added.
A field cannot contain another field or span inside it but it is possible to add a span around a field.
To insert a span, highlight the text which requires conditional logic and click Insert span. Content control will be inserted into the document and the work pane will present condition builder screen. Simplest show/hide spans use a Yes/No question. Add a variable which determines the need for the conditional text. When you create a new variable, it will default to Yes/No type and build a rule where the answer Yes ensures the text is shown and the answer No hides it. For example, the question can be “Is a guarantor needed?” and if a guarantor is required and the answer is "yes," the relevant paragraph appears in the generated document. If the answer is "no," the paragraph is excluded.
The show/hide spans can use other types of questions as well, such as the value of the contract or a specific jurisdiction. For example, ContractValue ismorethan 1000 or Jurisdiction is “England and Wales” where ContractValue is a number variable and Jurisdiction is a text selection variable are also valid span conditions. These conditions can be evaluated as true or false and therefore drive the inclusion or exclusion of the text.
Use the “variable” – “operator” – “value” to insert any basic spans into your template. If you need to combine multiple rules or use more advanced expression, or a different type of span, switch to advanced mode. To find out more about advanced mode, see the section “Advanced mode” below.
Unlike fields, spans often contain other fields or spans inside them. For example, if the contract has a guarantor clause controlled by a span where we ask, “Is guarantor needed?”, the guarantor clause is likely to insert the Guarantor name and details in it as fields. These questions will be asked on the questionnaire only if the initial question controlling the span is answered with “Yes”.
If you want to insert span around your current span, you need to highlight the whole span including the lozenges and the work pane will show the markup home screen where you can click the Insert span button. Inserting a span or a field inside of a span is also possible but requires a different approach. When you click on the text inside the span, the work pane will display the span expression. To insert a new field or span inside of this span, click the three-dot icon at the bottom left and choose Insert field or Insert span from there.
Clicking inside a field (e.g., TenantRegisteredOffice) highlights the content and shows the relevant automation for that field.
Similarly, switching inside a span (e.g., GuarantorName) highlights the content control and displays the specific automation details for that span, it shows you the closest (innermost) content control, which is GuarantorName.
If you click outside a content control, the system shifts focus and displays the markup for the nearest applicable span
How to Apply Formatting to a Field
You can change the format of the text that will be inserted into the generated document, such as italics, underlining, or highlighting. The formatting applied to the brackets between the field lozenges will carry over to the inserted text in the generated document.
Since variables can be used in multiple fields or spans, they are stored separately from the markup expressions. If you need to change the question or other details of the variable, no extra steps are required to confirm the action. Changes to variables are automatically saved without needing to click "Apply". However, if you modify the markup expression (the definition of the field or span) in a specific place within the document, you will need to click "Apply" for those changes to take effect.
Remember that if you make changes to a variable, those changes will automatically reflect across all instances where this variable is used. For example, if you modify the "Guarantor" variable, any reference to this variable in the document will be affected.
In the advanced settings tab, you have the option to define default values, set minimum and maximum values, select a mask, and adjust format settings. Additionally, you can select default case formatting, such as uppercase or proper case. These settings apply to all types of variables, including text, numbers, and dates.
An example of advanced settings options available for a text variable. These options may vary depending on the specific variable.
Advanced mode allows you to add any definition for fields and spans, giving you more control over the markup in your template. To access advanced mode, click on an existing markup or insert new one, then click on the Advanced mode switch in the top right side.
It also offers predictive text functionality that provides suggestions based on the user's search query to assist them and improve precision, formatting, and usability.
Here are some examples of expressions which can be added in Advanced mode.
Use simple arithmetic operators to add calculations to your fields. For example, if you need the price of the product with the VAT, your advanced mode expression can be ProductPrice*1.2 where ProductPrice is the decimal number variable containing the net value of the product.
To adjust the case or format of your field, you can add the details of the format into your expression. For example, to insert the company name in uppercase, add CompanyName format upper where CompanyName is a text or text selection variable. You can also use special formats available for each datatype to manipulate the way information will appear. For example, to insert the rent amount in words, add RentAmount format “currencywords” where RentAmount is a decimal number variable. Note that the datatype-specific formats are entered with double quotes. For more information on format options, check help information about Formats.
If you want to combine two conditions in a span expression, you can do so in the advanced mode. For example, you can use operator “and” for these two conditions: ContractPrice ismorethan 1000 and Jurisdiction is “England and Wales”.
When using Advanced mode, it is important to follow the syntax rules to ensure that the expression is valid. Refer to our help documentation for examples of the expressions and check your template for issues regularly to ensure that your automation logic has been entered correctly.