8 Creating a Rule
8.2 Creating a Rule That Raises a Message
You can define a rule that raises a message when the rule is triggered.
A typical use case for creating such rules is to validate the user's entries. For example, you could create a rule that displays an error message when the person's age is less than 18.
Creating such a rule is a two-step process:
1. Create a MessageDefinition object that contains the message text.
2. Create a rule with the Raise Message action in the THEN statement, referencing the MessageDefinition object you have created before.
Related Information
Creating a MessageDefinition Object [page 111]
The MessageDefinition object contains the message text.
Creating a Message Rule [page 112]
Here you define a rule that should display a message when it is triggered.
8.2.1 Creating a MessageDefinition Object
The MessageDefinition object contains the message text.
Procedure
To create a MessageDefinition Object:
1. Go to Administration Tools.
2. In the Company Processes & Cycles portlet, select Employee Files Manage Data . 3. In the Create New field, select MessageDefinition.
4. In the text field, enter the message text that should be displayed to the user.
In this example, the message text that will be displayed to the user is National ID is required:
Configuring Business Rules in SuccessFactors
Creating a Rule © 2014 SAP SE or an SAP affiliate company. All rights reserved. 111
5. Enter an external code for the MessageDefinition object.
6. Enter an external name for the MessageDefinition object.
7. Optional: You can also define parameters. The parameters are like placeholders that are filled with dynamic values when the message is called up.
Here's an example of a message with parameters:
Here's what these parameters mean:
○ dataType: Select the data type of the parameter. For example, Date for a date parameter, String for a text entry, and so on.
○ externalCode: Enter an external code for the parameter.
○ externalName: Enter an external name for the parameter. This name is displayed as the parameter's label when you assign the message to the rule in a later step.
○ status: Select Active.
Note: In this step you only define what type of parameters you want to use in this message (for example:
Date). The concrete parameters are defined when you assign the message to the rule (for example: Position Entry Date).
8. Save the message.
8.2.2 Creating a Message Rule
Here you define a rule that should display a message when it is triggered.
Prerequisites
You have created a MessageDefinition object that contains the message text to be displayed. For more information, see Creating a MessageDefinition Object.
Note
Limitations for Messages:
112 © 2014 SAP SE or an SAP affiliate company. All rights reserved.
Configuring Business Rules in SuccessFactors Creating a Rule
● There is a known MDF issue: Rules are not triggered for composite children. Thus, if there is a rule with a message assigned to a child object, the message is not shown when the parent object is saved, deleted, or changed.
● Do not use the initializeRules event for MDF objects to trigger rule messages. The initializeRules event is used only for setting default values, but not for validation.
● Rule messages are triggered for the first one-to-many composite child only.
For example, there are two object definitions: ParentDefinition and ChildDefinition. ParentDefinition has a field 'children' which is a one-to-many composite relationship to ChildDefinition. Also, ParentDefinition has a rule attached to Save event, this rule raises a warning message if 'children.externalCode' equals to 'warningCode'. If the user creates an instance of ParentDefinition and specifies several children, then the rule is executed for the first child only. So if the first child has 'warningCode' externalCode, then the message is raised, but if some other children have this code, then no message is shown.
Procedure
To create a rule that raises a message:
1. Go to Administration Tools.
2. In the Company Processes & Cycles portlet, select Company Settings Configure Business Rules . 3. Click Create New Rule.
4. Enter the conditions that cause the error message to pop up in the IF conditions.
5. Enter the THEN conditions where you refer to the message. Select the following:
a) As Output type, select Raise Message.
b) As Message, select the MessageDefinition object that you have created before.
c) If you have defined parameters for the message when you created the MessageDefinition object, enter or select the concrete parameters that should be used in this rule.
Here's an example, where the date is the position entry date, and the manager is derived from the supervisor field:
d) As Severity, select whether the message is an error, warning, or info message. See also Message Severity.
Please note: You can define that messages with several severities are raised simultaneously for the same object. If you do this, only one dialog is shown containing all the messages, and the strictest severity is used to determine the dialog type. For example, if there is one Info and one Warning message raised at the same time, the message is shown as a Warning dialog box, containing both messages.
e) In the Associate Message To field, select the field where the user action happens that triggers the message.
6. Save the rule.
Configuring Business Rules in SuccessFactors
Creating a Rule © 2014 SAP SE or an SAP affiliate company. All rights reserved. 113
Next Steps
You have to assign the rule to the corresponding object.
For more information about how to assign rules to objects, please refer to:
● Assigning a Rule to an EC Object in Administration Tools
● Assigning a Rule to an MDF Object
8.2.3 Message Severity
The severity defines whether a message is an error, warning, or info message.
Severity Result
Error The user cannot save the data changes as long as the error still exists.
Warning The user can accept the warning and save the data changes.If the user does not accept the warning, the data change is not saved.
Info The system displays an information dialog that automatically fades away after 5 seconds.
The user can also dismiss it manually by pressing the OK button.
Note
Error is the strictest severity, Info the lowest severity.