Human Capital Management Blogs by SAP
Get insider info on HCM solutions for core HR and payroll, time and attendance, talent management, employee experience management, and more in this SAP blog.
cancel
Showing results for 
Search instead for 
Did you mean: 
NeeleshKamath
Product and Topic Expert
Product and Topic Expert

Introduction


In this Blog, I am going to demonstrate a use case where we need to create rules based on field changes of an MDF object. Reason for the blog: Most of the customers/partners are unaware of this functionality and find challenges to implement use cases in MDF which requires field comparison for custom applications. This is similar to the Model concept for HRIS Objects like Job information, Compensation Information where we have the capability to check previous value and current values of fields and decide on next steps in rules.

Typical examples include:

  • Based on field value changes, you would want to trigger a specific workflow

  • You would like to set specific event reasons in Position Object based on different combination of field changes

  • You would like to raise validation messages based on field changes


Initially, this concept was delivered for Position but now this can be used for a custom MDF as well. The concept used by MDF is a parameter called “OriginalValues”. The OriginalValues is a replica of the base object (any custom MDF or Position object). The OriginalValues parameterized object stores the previous values for all attributes of the base object.

I will demonstrate this by using a simple custom MDF. I have a custom MDF named “Employee Stock”. An employee can be granted a stock value. But if an admin/user tries to change the value or rather give a jump of more than 200, then a validation error needs to be thrown. For example, lets say we have granted 100 shares to an employee. Now if we try to change that value to greater than 300, it should throw an error. If the difference is less than 200 it should allow us to save

 

 

 

Configuration of Custom MDF & Rules


The custom MDF has three fields:

External code: User

Effective Start Date: Date

Stock Value: Decimal



Create a rule as below. Add an additional parameter named “OriginalValues” with base object as Employee Stock

LATEST UPDATE

You don't need to add these parameters manually now. Create the rule using the MDF rule scenario (not "Basic")! With that, the necessary parameters (e.g. previous value, original value...) are correctly added to the rule and you do not need to take care of the correct spelling or code. This prevents issues



Attach the rule at the onSave hook of Employee Stock Object Definition


Working


An Employee is granted Stock value of 100 initially as shown below



Scenario 1:

Manager/Admin tries to provide a jump of 250 by changing the value to 350



We see an error message thrown. This basically compares 100 with 350 and sees that jump is more than 200 as per rule config. Hence the message

Scenario 2:

Manager/Admin tries to provide a jump of 150 by changing the value to 250

We see that data is saved successfully as the difference between previous (original) value and the current value is less than 200 as per our rule



 

The above is a simple example to demonstrate this feature for custom MDF. You can extend this to any specific use case which involves field comparison across MDFs
17 Comments