The Sequence of Events for MDF Business Rules
This article came into being because currently there is no guide that shows the complete sequence of Events and Messages for Business Rules and because the help guide Implementing the Metadata Framework somewhat feebly says that MDF Objects need the MDF Rules and not the basic ones.
Within each Event for MDF Objects, the MDF Business Rules are executed in the same order in which the Rules are assigned to the Event. However, the sequence of the Events themselves is fixed and cannot be changed. Similarly, each Message is displayed in the moment allotted for it within the sequence of the Events.
The predefined sequence of Events is described in the guide Implementing the Metadata Framework (§ 11.1.3 Order of MDF Based Rule Execution, p. 140), which, unfortunately, does not show neither the complete sequence of Events nor the specifics in the order of Messages.
In this article, we will provide the missing details about the sequence of Events and Messages for the MDF-Based Rules.
Scenario ‘Rules for MDF Based Objects’
The aforementioned guide explains that each scenario for Business Rules has its own moment within the Event, in a word, regardless the actual order within the Event, the Rules of scenario Basic are always executed before the similar Rules of scenario ‘Rules for MDF Based Objects.’
However, the guide also mentions that Rules of scenario Basic should not be used for MDF Objects at all. For details about the recommendation, see § 11.1 Business Rules in MDF, p. 135.
We absolutely agree with this recommendation because the Business Rules of scenario ‘Rules for MDF Based Objects’ have many advantages over the Rules of scenario Basic.
Moreover, if you have already assigned the Basic Rule to the MDF Object, then we recommend changing the Rule’s scenario with use of the ‘Change Scenario’ tool (see Figure 1). For details about the tool, see the guide Implementing Business Rules in SAP SuccessFactors, § 10 Changing a Rule Scenario, p. 71.
The sequence of Events
The sequence of Events of the MDF Object depends on the operation with the Object: View, Create, Insert, Correct (Edit) and Delete. Figure 2 shows the sequence of Events after each operation.
For example, as shown in Figure 2, the Insert operation results in the On-Load Event that is followed by the On-Change Event with Evaluation and Validation Purposes that is followed by the Save Event with Workflow, Evaluation and Validation Purposes that is followed by the Validate Event that is followed by the Workflow Confirmation pop-up that is followed by the Post-Save Event with Validation and Alert Purposes that might be follow by the On-Load Event. For explanation, see the Insert operation in Figure 2 below.
The On-Load Event is intended for the operation View; however, this Event is also triggered by all other operations (Create, Insert, Correct and Delete). Operations Create, Insert and Correct trigger the On-Load Event differently, moreover, one and the same operation triggers the Event differently in People Profile and Manage Data. Operation Delete triggers the On-Load Event for the record that is valid for today, and also differently in People Profile and Manage Data. Taking into account all the mentioned differences, the On-Load Event should be cautiously used and thoroughly tested.
The On-Change Event can be triggered by the Business Rule that is assigned to another On-Change Event. Someone might think that it opens new horizons of the automation; however, such configuration is overcomplicated and, moreover, might result in the circular references therefore, as a general rule, such configuration should be avoided.
Figure 3 shows the elements that make up the sequence of Events
For more details about the sequence of Events, see the guide Implementing the Metadata Framework, § 11.1.3 Order of MDF-Based Rule Execution, p. 140.
The moment for the Workflow-Purposed Business Rule within the Save and Delete Events
In Figure 2, the Workflow-Purposed rules are marked in gray because they do not respect the order of the assignment in the Object Definitions and are always executed in the moment specially allotted for them:
- On the Save Event, the Workflow-Purposed Rule is executed the first;
- On the Delete Event, the Workflow-Purposed Rule is executed the last.
For more details, see the guide Implementing the Metadata Framework, § 12.2 Need to Know About Workflows in MDF, p. 162.
The sequence of the Raise Message actions
The Raise Message action is used to display the pop-up Messages from the Business Rules with the Validate, the Evaluate and the On-Load Purposes. The messages are displayed in the fixed moments within the sequence of Events, as shown in Figure 2. Within each of the moments, the Messages are displayed in the same order in which they have been raised by the Business Rules.
All Messages of each Event are grouped by Severity (Error, Warning and Info) and displayed after the Event. The dialog box shows only the group of Messages with the highest Severity:
- If there is at least one Error Message, then the dialog box shows only the Error Message(s);
- If there is at least one Warning Message and no Error Messages, then the dialog box shows all Messages, including the Info, as a Warning;
- If there are neither the Error nor the Warning Messages, then the dialog box shows all Info Messages.
The Warning and the Info Messages of the Save, the Validate and the Post-Save Events are additionally grouped by Severity and displayed before/after the Workflow Confirmation pop-up, as shown in Figure 4.
If we count the order of all the pop-up messages raised by these Events, then the Workflow Confirmation pop-up is displayed the fourth in a row, namely: after the dialog box with the Save and the Validation Warnings and before the Post-Save Error Messages.
Below are some examples on how to use the different types of messages:
- The Post-Save Error Message (see number 5 in Figure 4) is the last moment to stop the system from saving the record, which can be used for validation of configuration in the production instance.
- The Warning Messages of the Post-Save Event should not be used at all because they are not normally displayed.
- The Info Messages of the Post-Save Event, on the contrary, are more preferable because the two other Events (Save and Validate) might mix the Info Messages with the Warnings.
The sequence of Events, Business Rules and Messages is a complex topic that is not fully described in the help guides. The technical details provided in this article will help the reader better understand the MDF Business Rules and significantly improve the custom solutions based on MDF Objects.
- Latyshenko, V. V., 2022. Build Custom Solutions Using Business Rules for MDF Objects. SAPinsider, [online]. Available at https://sapinsider.org/expert-insights/build-custom-solutions-using-business-rules-for-mdf-objects/ (Accessed: 20 March 2022).
- Implementing the Metadata Framework (MDF). Document Version: 2H 2021 – 2022-03-18. Available at https://help.sap.com/doc/067c84408d824c7382637fc264e11310/latest/en-US/SF_IMP_MDF.pdf (Accessed: 20 March 2022).
- Implementing Business Rules in SAP SuccessFactors. Document Version: 2H 2021 – 2022-03-18. Available at https://help.sap.com/doc/8c6720bf5d0b4715ab10fb1b4f69c4f2/latest/en-US/SF_PLT_Implementing_Business_Rules.pdf (Accessed: 20 March 2022).
 Except for the Workflow-Purposed MDF Rules, which are executed in the moment allotted to them.
 Except for the Business Rule triggering the Workflow within the Save Event, when the Workflow-Purposed MDF Rule precedes the Basic Rules
Author: Vladimir Latyshenko