Building Constraint Exception Messages
The existing message number SL_100001 has the text "The &1 entered is not valid." You can reuse this message number and text to construct a custom constraint error message.
- Specify an Object Name for a SQL constraint, using the rules specified in the field description.
- Select an existing Message Text, and the Message Number is displayed. For example, if you select the Message Text "The &1 entered is not valid." the Message Number SL_100001 is displayed.
- Specify a Message Description that describes how and when this instance of the message is used. For example, "This message is displayed when <state> is updated on an Applicant Reference to a value that does not exist in any state."
- Specify the Message Type. For any given Object Name, you can only have one Message Type with the same value. For example, select Message Type 17 (Constraint Message).
- Specify the Object Type. For example, select 0 (Table Object).
- Specify the Message Severity.
-
Save the record. If the type is 17
(Constraint Message) or 18 (Delete
Constraint), the Build Messages grid
is enabled, where you can specify this information:
- If the Message Text in the main grid has multiple substitution expressions (&1, &2, etc.), add a row with a Sequence Number corresponding to each of the substitution expressions.
- To reference the substitution text to use, either specify a Message Number from the Maintain Application Messages form or specify another existing Object Name.
- A Message Number is always required. Specify MG_1 to indicate that the value in the Object Name field is to be used to look up the substitution text. If the Message Number is any value other than MG_1, then that value is used to look up the message text on the Maintain Application Messages form.
- If the Object Name field is used, select the appropriate value from the drop-down list.
- The Message Text field displays the text that will be displayed in place of the substitution expression.
- Save the record again.
- If your company uses source code control, click Generate Message Script File. In the Generate Application Messages Script form, specify the appropriate file path and filter information, and click Generate SQL Script File.