Structure of a Rule

A rule includes the following attributes:

  • identifier, which is a number or a string that can help you distinguish multiple rules in the XML file. We recommend specifying a unique identifier for each rule.

  • title, which specifies the key for a key-value pair in the properties file, where the value is the title of both the violation message and the error message for the rule. The properties file also contains the text used in each of the messages.

  • enabled, which is a flag to enable or disable a rule

  • restrictTo, which is an optional attribute that allows the rule to apply to only the specific time sheet policies listed by ID number

  • sql, which defines the rule

  • violation, which specifies the key for a key-value pair in the properties file, where the value is the text of the violation message for the rule.

  • error, which specifies the key for a key-value pair in the properties file, where the value is the text of the runtime error message for the rule. The text can be generic and apply to any number of rules, or it can be specific to one rule.

The SQL in the rule can use the following tokens, which get resolved at run time:

  • [TMG.TIME_SHEET_ID], which represents the time sheet being submitted

  • [TMG.CURRENT_USER_ID], which represents the user who is currently logged in, not necessarily the time sheet resource

The following examples of rules are provided, in order of increasing complexity, to describe the effect of various rules and properties files on the occurrence and content of violation messages and error messages.