Field Code Anatomy
In addition to system variables such as Contact.FirstName, field codes may contain formulas. This section provides an outline of formula usage. For details on many of these topics, see the information provided in "Field Codes in Standard Responses," in the eServices 8.1 Reference Manual.
You must always delimit field codes by using <$ … $>. If you type a field code directly into the body of a standard response, then you must enter the delimiters yourself. If you select from the list of field codes in Knowledge Manager, then the delimiters are added automatically.
The text that appears inside the delimiters is a formula. Field code formulas are very similar to formulas in other applications, such as Microsoft Excel.
A formula is a sequence of one or more operands (such as numbers and text strings), separated by operators (such as +
For example, in the following formula, 2 and 3 are operands and + is an operator:
- <$2 + 3$>
Operands can be values that do not change (constants), or values that vary based on the context. In the previous formula, all the operands are constants, so the formula always evaluates to 5. The next formula, on the other hand, evaluates to a different value for each agent who uses it:
Field Code Syntax
To summarize field code syntax:
As stated previously, a field code must be delimited by <$ ... $>.
Alphabetic strings, whether constants in formulas or elsewhere in a field code, must be enclosed in double quotes.
Numeric constants require no special treatment.
- You must use special characters for some purposes. For example, for your field code to render with a line break, you cannot simply type a carriage return. Instead, you must insert the expression \n. A list of these special characters is available.
HTML in Field Codes
With special configuration, field codes can contain HTML markup; for example, you could have a field code <$my.agent.signature$> defined as
Sam Agent<BR /> Acme Products<BR /> 29 Exterior Blvd<BR /> Springfield, CX 09090<BR />
To enable this, you must use the Java property -Dsrl-field-code-allow-html=true, in one of the following ways:
- Add it to the JavaArgs section of ContactServerDriver.ini
- Add it as an argument to the startup command line in contactServer.sh.