Managing Business Rules

Objective

After completing this lesson, you will be able to manage Business Rules in SAP SuccessFactors Employee Central.

Business Rule overview

Business rules are used to add application logic to the system and 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 pop-up 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. Complete the interaction or use the table to learn more about triggers or rule events.

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 Job Structures page (for example, location, 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 saved.

Validate 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 page.

Calculate 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 saved.Sends alerts to remind users of upcoming system events, such as, visa or contract expiry.
onPostSaveHRIS ElementAfter changes to an object is 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, etc.

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 to initialize HRIS Elements during all Hire/Rehire processes (for both old and new employments) using the Employee Information Model base object. 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 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 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.

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 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.

Standard vs. Model Base Objects

The base object defines what you can configure in the rule. Unlike MDF objects, Employee Central objects have standard and model base objects. The model base object is required under certain circumstances.

For example, to set field properties, 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 properties:

Required

You can set a field required or not required. Assign the value of ‘true’ or ‘false’

Visibility

You can set the visibility of a field. Choose a value of "None", "Edit" or "View" from the drop-down.

Value

You 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 drop-down 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.

Create a Business Rule

Business Example

ACE Corp would like to streamline the New Hire process for its admins. Most new hires are in the United States and use a Social Security Number as their primary National ID. In this exercise, you will create a configurable rule that will, as a default, autofill the fields National ID Card Type, Is Primary, and Country.

Task 1: Create a Hire/Rehire Rule

Steps

  1. Go to Manage Business Rules to create a hire/rehire rule. Set the IF statement to "Always True". Set the THEN statement to default the Country, Card Type, and Is Primary fields. Use the table to define the rule.

    National ID Rule

    FieldValue
    Rule ScenarioTrigger OnInit Rules for Hire/Rehire
    Rule NameUSA National ID
    Rule IDINIT_NAT_ID

    THEN Statement

    THEN STATEMENT
    SetEmployee Information Model.National ID Information.Country.Valueto be equal toTextUSA
    SetEmployee Information Model.National ID Information. Is Primary.Valueto be equal toBooleanYes
    SetEmployee Information Model.National ID Information.National ID Card Type.Valueto be equal toTextssn

    Note

    The order of the expressions in the rule matters. It should be Country, then Is Primary, then Card Type. The text values are also case-sensitive.
    1. Go to Configure Business Rules.

    2. Select Create New Rule (+).

    3. Expand Employee Central Core Scenarios and select Trigger Rules for Hire/Rehire.

    4. Create the rule using the table, National ID Rule.

    5. For the condition, set the IF statement to Always True.

    6. For the action, follow the table, THEN Statement.

    7. Enter each SET as separate expressions.

    8. Delete extra entry lines from the collection filter.

      Creating a new rule 'National ID Rule'
    9. Save.

Task 2: Assign the Rule

Having created the rule, you will now associate the new rule with the HRIS field or element.

Steps

  1. Go to Manage Business Configuration to assign/set the rule to trigger onInit in the National ID Card.

    1. Navigate to Manage Business Configuration.

    2. In the HRIS Elements, select nationalIdCard.

    3. In the Trigger rules, select Base Object: Employee Information Model | Event Type: onInit | Rules: USA National ID

    4. Save the change. Accept the changes to the Data Model by BCUI by choosing Yes.

Task 3: Test the Rule

Having created the configurable rule and associated it with the HRIS element, you will now need to test the rule.

Steps

  1. Use the Add New Employee wizard to test if the National ID fields are prepopulated.

    1. In your instance, go to Add New Employee and enter the following details:

      FieldValue
      Hire Date[Today’s date]
      CompanyACE USA
      Event ReasonNew Hire
    2. In the National ID Information screen area, verify that "United States" appears in the Country field and "Social Security Number" appears in the National ID Card Type field, as default.

    3. Select Cancel.

Summary

Here are the key takeaways from this lesson:

  • Business rules add application logic to automate Employee Central processes like workflows, alerts, and event reason derivation.
  • Rules include IF conditions (or Always True), THEN actions, and a trigger/rule event that starts processing.
  • IF logic controls when actions run; ELSE/Else If support alternative outcomes and multiple conditions.
  • THEN actions can Set values, Raise messages, Create/Delete objects, Execute actions, or Add to collections.
  • Rule event types (for HRIS) include onChange, onInit, onSave, onView, saveAlert, and onPostSave.