2092849 - How to create a Business Rule to validate data on change/save, and provide a Warning or Error message

SAP Knowledge Base Articles - public

2092849 - How to create a Business Rule to validate data on change/save, and provide a Warning or Error message


  • We need to create a message that pops up when a certain field is not filled in, or to validate certain field criteria either on change or on save. 
  • We would like to validate whether a certain field is set correctly, or just promt the end user to check to ensure certain data is filled out correctly in the EC portlet.


  • SAP SuccessFactors HCM Core
  • Employee Central


Scenario 1 - onChange)

  • In this scenario we will be raising a Warning Message when the Business Unit is changed, prompting the end user to verify that the FTE field is correctly populated -:

1) Create the Warning Message you wish to display when the rule is triggered. This is done via Admin Center > Manage Data > Create New “MessageDefinition”


2) Create the rule via Admin Center > Configure Business Rules, set the Base Object to the EC portlet this rule will be triggered in, and then in the IF condition, set the field/value the system needs to validate. In the below example we have added a few different checks to validate whether the Business Unit value has changed in the transaction, or whether the FTE value is Null (blank) or whether the FTE value is 0 (note you can choose different fields to validate against to determine whether the rule should trigger or not) -:


  • Please ntoe in this example we use the "Error" option to raise this message. The error option will prevent the transaction from saving if used in an onSave rule, until the IF conditions of the rule are no longer met. In the above scenario (onChange) the rule will trigger but not prevent saving the transaction

3) You will then need to assign this rule as a trigger to your configuration, which can be done via Business Configuration UI (BCUI) (Admin Center > Manage Business Configuration) > navigate to the element which your rule has its Base Object defined. In the below example we created a Job Information rule, which we will assign to the field Business Unit in the Job Information element. We click "Details" link next to the field "Business Unit" and in the Details menu, we look to the bottom of the pop-up and assign the new rule there (as we want the rule to trigger when changing the Business Unit field) -:


4) In this scenario the rule is setup to trigger “onChange” on the Business Unit field in Job Info, so when Business Unit is changed, OR when the FTE is Null OR FTE is 0, then the system will trigger the rule warning.


Scenario 2 - onSave)

  • In this scenario, we have configured a rule to trigger on save, and it will check the values in the Business Unit and FTE fields as before, and if they are equal to what is defined in the rule, a Warning message will be triggered (a bit different to an Error message) -:


1) You can configure this rule to trigger “onSave” based on other validation information. Again this is set in the BCUI (Admin Center > Manage Business Configuration) and again set in the related element - Job Information - but this time we will assign it to the element itself as an onSave rule (which is done at the bottom of the element view) -:


2) “onSave” rules trigger upon clicking the save button, and the Warning message will allow the operator either Proceed and save the change, or, Correct to abort the save and make the requested adjustment -:


  • You could also change the Message Type to either "Error" (it will not let the operator proceed until the rule passes validation) or "Info" which will pop up for 5 seconds with the message, offer no options, and continue the save operation.


EC , Success Factors , Raise Message , Error Message , Warning Message , Business Rule , KBA , sf employee , sf employee_central , raise message , LOD-SF-EC , Employee Central , LOD-SF-EC-RUL , Business Rules & Event Derivation , How To


SAP SuccessFactors HCM Core all versions


image b.jpg
image c.jpg
image d.jpg
image e.jpg