Managing Business Rules

Objective

After completing this lesson, you will be able to manage business rules.

Business Rule Overview

Business rules are used to add application logic to the system. Business rules are used in different scenarios across all SAP SuccessFactors solutions. In Employee Central Core, business rules are used to automate HR processes, such as workflow and event reason derivations, alert notifications, and many others.

Business rules are comprised of the following:

  • Condition (IF) - The logic that must be met before the system takes action. When you want the system to apply the action every time, set the IF statement to Always True .
  • Action (THEN) - The logic that defines how the system reacts when the condition is met. Some application-specific scenarios do not require a THEN statement.
  • Trigger or Rule Event - The event type that activates the rule processing.

Business rules can be applied to any application of SAP SuccessFactors. In this unit, we will only cover the rules for Employee Central data.

IF Logic

IF statements are the conditions in the rule that must be validated. It determines when the THEN logic is executed. The IF logic uses "and"/"or" statements. The following list provides examples of when IF logic is used:

  • If a particular option is chosen from a picklist
  • If specific text or numbers are entered into a field (or if they are greater than or less than the values stated)
  • If a field value has changed

Some rules are created without an IF statement. This is also known as Always True, which means there are no conditions for the system to validate. Once the rule is triggered, the system will execute the THEN statement.

Else If statements allow you to combine several conditions in the same rule.

THEN Logic

The THEN statement determines the system action once the condition is met. Depending on the use case, these are the actions the system can execute with Then logic:

  • Set: This automatically propagates information based on existing information or a specific value chosen.
  • Raise message: This brings a popup box up on the screen that provides additional information to the user filling in the information or an error message that something was done incorrectly.
  • Create: This creates a child object. Examples include adding a new pay component to an employee or creating another child object attached to the parent object.
  • Delete: Delete data from the database when the condition is met. For example, you can remove a pay component when the employee moves away from London.
  • Execute: Carry out specified action when the condition is met.
  • Add to: Add items to a collection when the condition is met. For example, you can create a single rule to assign multiple learning courses to new hires.

ELSE statements can also be added. These actions occur when THEN statements are not applicable because the IF condition is NOT true.

Triggers or Rule Event Types

Triggers, also called rule event types, initiate the rule processing. The system will not validate the conditions (IF statements) or execute any actions (THEN statements) if no user action activates the rule.

There are six rule events associated with HRIS elements and fields. Rule events define which user action sets the rule execution.

Rule Event for HRIS Elements

This event/triggerIs assigned at ...Rule is triggered...Use this event to...
onChangeField level onlyWhen a field value is changedActivate rules as soon as the user changes a field
onInitHRIS Element level

During hire/rehire, using Add New Employee page

When creating a new FO record in Manage Org Pay and the Job Structures page (for example, location and event reason)

Set field properties (for example, making fields mandatory or hiding fields) or default values you want to be shown as soon as the user calls up the Add New Employee or Manage Organization Pay and Job Structures UI.
onSaveHRIS Element levelWhen the page is savedValidate user entries when the user wants to save the changes. For example, if the user didn't make an entry in a mandatory field, an error message is displayed.
onViewHRIS Element levelWhen viewing transient fields on the pageCalculate fields that are transient (this means that the result is not a fixed value stored on the database but is calculated during rule execution when the user calls up the page). For example, to calculate an employee's age.
saveAlertHRIS Element levelWhen a change to jobInfo, compInfo, employmentInfo, workPermitInfo is savedSend alerts to remind users of upcoming system events, such as visa or contract expiry.
onPostSaveHRIS ElementAfter changes to an object are savedTrigger events for Intelligent Services

Rule Scenarios

Rule Scenarios for Employee Central Core

There are many use cases why business rules are created for Employee Central data, such as to automate the approval process, identify the correct event reason based on proposed changes, set default values, and so on.

SAP SuccessFactors has provided the rule scenarios for each solution's most common use cases, including Employee Central. Here are the rule scenarios for Employee Central Core:

EC Core Rule Scenarios

Rule ScenarioDescription
Generate Assignment ID ExternalThis scenario creates the rules that generate the values for Assignment ID External based on the MDF Sequence objects. Create a single rule only based on this scenario.
Generate Employee ID for Hire/RehireThis scenario generates an Employee ID from the Metadata Framework Sequence (MDF) and assigns it to the User ID field of the Employee Information object during Hire/Rehire with the new employment process.
Rules for Hire/RehireThis scenario will be used for the customer who wants to create any business rules that trigger in hire scenarios, for example, to determine default values or the visibility for certain fields during the hire/rehire process. This limits the base objects to either Employee Information or Employee Information Model.
Trigger onInit Rules for Hire/RehireThis scenario is to initialize HRIS Elements during all Hire/Rehire processes (for both old and new employments) using the Employee Information Model base object. It is limited to the onInit event type.
Trigger Event Reason DerivationThis scenario is used to derive the event reason automatically for transactions initiated in Job and Compensation Information entities. This limits the base objects to the Job or Compensation Information model.
Generate Employee Central AlertsThis scenario creates the rules that generate alerts for Employee Central data, for example, alerts for job information changes.
Enforce New Employment for RehireThis scenario is for configuring a rule that validates the business requirements to enforce new employment and returns an error message if the conditions are not met.

The rule validates changes made in Job Information. For example, when an employee changes the legal entity, the system validates the change based on the rule configuration. The validation either approves the changes or enforces new employment.

Trigger WorkflowsYou can use this scenario to create rules that trigger workflows to approve data changes. In Manage Business Configuration, rules created using this scenario can be assigned only for the onSave event type.
Display Internal Job HistoryThis scenario creates the rules for the Internal Job History block configuration.
Validate HRIS ElementsThis scenario creates business validation and raises alert messages on HRIS elements.
Calculate Full-Time Equivalent (FTE)This scenario calculates a user's full-time equivalent (FTE) using the Job Information Model base object.
Trigger onPostSave Events for Job InformationYou can use this scenario to create rules that trigger events or alerts after changes to Job Information are saved. Rules can only be assigned using onPostSave event type.
Trigger Cross-Entity RulesThis scenario is used to configure cross-entity rules triggered from the source entity, and changes are executed on the target entity. Cross-entity rules can set values for fields in a different entity. For example, you can configure Job Information changes that update Compensation Information. Currently, it is supported only for specific employment-related entities. Currently, only five cross-entity rules are allowed.
Trigger onChange Rules for HRIS ElementsYou can use this scenario to create rules that trigger when HRIS fields are changed, for example, propagating Job Information fields from the Job Classification record. Rules can only be assigned using onChange event type.
Trigger onSave Rules for HRIS ElementsYou can use this scenario to create rules that trigger when saving changes to the HRIS elements. Rules can only be assigned using the onSave event type.
Trigger an Off Cycle Event BatchYou can use this scenario to create a rule for an Off Cycle Event Batch that uses the SET operation in the Then statement . This rule is executed during the Off Cycle Event Batch processing job.
Trigger Event for Off Cycle Event BatchYou can use this scenario to create a rule for an Off Cycle Event Batch that uses the EXECUTE operation in the Then statement. This rule is primarily used to trigger PM forms. The rule is executed during the Off Cycle Event Batch processing job.
Trigger onView Rules for HRIS ElementsYou can use this scenario to create rules that default the value for a field, change field properties, or calculate fields that are transient. Limited to the onView event type.
Save Changes to Foundation ObjectsYou can use this scenario to create rules that save changes to Foundation Objects and their fields, for example, defaulting the standard weekly hours to a location.

To learn more about the different Employee Central rule scenarios, visit the Configure Employee Central Core course

Migrating Basic to Application-Specific Scenario

Many rules created before the availability of application-specific scenarios use the Basic Rule scenario. These legacy rules can be migrated to application-specific scenarios either one at a time or by mass change.

  • To change the rules individually, go to Configure Business Rules. Choose the rule and select Change Scenario. This will open the wizard that will guide you through the process.
  • For mass changes, go to Check ToolMigration tabBusiness Rules Application. Run the check and follow the migration steps.

Rule Base Objects: Standard vs. Model

The base object defines what you can configure in the rule. Employee Central objects have standard and model base objects. The model base object is required if you want to use the field's properties in the rule.

For example, to set the field's visibility property, you must choose a model base object. The base object also defines what event types you can use when you assign the rule to the Employee Central object in the data model. You cannot use onView events for changes done on the Add New Employee screen.

For model base objects, you can set the following field properties:

RequiredYou can set a field as required or not required. Assign the value of ‘true’ or ‘false’.
VisibilityYou can set the visibility of a field. Choose a value of "None", "Edit", or "View" from the dropdown.
ValueYou can use this property when you want to combine setting field properties with setting default or conditional values. When you select Value, you have to select the corresponding value in the dropdown menu when creating the rule.
Previous Value

You can use this property when you want to compare an old value with a new value, for example, when a rule is triggered only when a certain value is changed to a new value.

You can also define that any data change to a specific field triggers the rule. For example, checking for any change to FTE could be done with the rule: FTE. Value is not equal to FTE. Previous Value.

aCreate a Business Rule

In this activity, you will create a rule that will auto-populate the fields National ID Card Type, Is Primary, and Country by default in the National Id Information during the new hire process.

Note

This exercise is a standalone activity and is not required for completing other hands-on exercises for this course.

Use the simulation if you don't have a practice system.

Steps

  1. Create a Business Rule: Use Action Search to navigate to Configure Business Rules.

  2. Select Create New and then choose Employee Central CoreTrigger Rules for Hire/Rehire.

  3. Fill in the following fields for your new rule:

    • Rule Name: USA National ID
    • Rule ID: INIT_NAT_ID
    • Base Object Type: Employee Information
  4. Click Continue.

  5. For the If Statement, select the Always True checkbox.

  6. Fill in the Then Statement: (When configuring the Then conditions, click Add Expression for each new row.) 

    The Then Statement

         
    SetNational ID Information Countryto be equal toTextUSA
    SetNational ID Information Is Primaryto be equal toBooleanYes
    SetNational ID Information National IdCard Typeto be equal toTextssn
  7. Click Save.

  8. Associate the Rule to the HRIS field or Element. Use Action Search to navigate to Manage Business Configuration.

  9. On the left, locate the HRIS element: nationalIDCard and click on it.

    At the bottom of the screen, in the Trigger Rules section, add your rules:

    • Base Object: Employee Information
    • Event Type: onInit
    • Rules: INIT_NAT_ID
  10. Click Save.

  11. Test your rule. Use the Action Search and navigate to the Add New Employee tool.

  12. In the National ID screen area, verify that the United States appears in the Country field, and Social Security Number appears in the National ID Card Type field as default.