SAP Knowledge Base Article - Public

3438482 - How to Create a Business Rule to Calculate User hire date Age Based on Current Hire Date

Symptom

How to Create a Business Rule to Calculate User hire date Age Based on Current Hire Date.

"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental." 

Resolution

There are two different ways in which the age of your employees can be displayed.

They are YY/MM/DD or the value in years (Rounded Down).

  • In order to use the YY/MM/DD format you must ensure the age field is a custom string field.
  • In order to use the value in years (rounded down) you must ensure the age field is a custom double (Numeric) field.

Step 1: Create  both custom Field

Via Code SDM Data Model 

    <hris-field id="custom-double1" visibility="both">
      <label xml:lang="en-US">User hire date Age calculation</label>
      <label xml:lang="fr-FR">User hire date Age calculation</label>
      <label xml:lang="en-GB">User hire date Age calculation</label>
      <label>User hire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-double2" visibility="both">
      <label xml:lang="en-US">Totalhire date Age calculation</label>
      <label xml:lang="en-GB">Totalhire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-double3" visibility="both">
      <label xml:lang="en-US">AddUser hire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-string19" max-length="256" visibility="both">
      <label xml:lang="en-DEBUG">String_hire date Age calculation</label>
      <label xml:lang="en-US">User String_hire date Age calculation</label>
      <label xml:lang="en-GB">String_hire date Age calculation</label>
      <label>String_hire date Age calculation</label>
    </hris-field>

Via :Go to Manage business configuration ( BCUI)

Step 2: grant a permission under: employee data

Step 3: Create rule: use base object : Trigger onView Rules for HRIS Elements

Go to Admin Centre> Configure Business Rules

Create a Basic Rule with Base object Biographical information.

  • For YY/MM/DD create a rule using the "Convert to YY/MM/DD" function for custom-string
  • For the age value (rounded down) use the "Difference in Years Round Down" function for custom-Double

Note: Please refer to Rule Scenarios for Employee Central Core

use base object : Trigger onView Rules for HRIS Elements

  • You can use this scenario to create rules that defaults the value for a field or change field properties or 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). In Manage Business Configuration, rules created using this scenario can be used only for the onView event type.

see

check result

Additional infos:

Add 2  custom double field and default to into custom field

Create a rule: 

chek result:

NOTE: onView, Calculated fields are transient fields and so no data is saved to the system. The Values will dynamically calculate each time that you visit the users Biographical Information. You will not be able to report on the value, so long as the rule is set to trigger onView.

See Also

  • 2345108 - How to Create a Business Rule to Calculate User Age
  • 2364155 - Age field not displaying values in Advanced Reporting
  • 2577292 - How to calculate age on a specific event date in Online Report Designer?
  • 2571171 - How to create a Age calculation field in Integration Center
  • 2515212 - How to get "number of years" an employee is working in the organization in ORD or Advance Reporting?
  • 2431354 - How to calculate the service anniversary (seniority) of an Employee who had break in service 
  • 2768749 - Termination Date excluded in calculation for Number of Months in Termination Rule
  • 2277956 - How to create a Business Rule

  • 2632119 - HRIS Sync: How to automate calculating Age / Work Seniority to synchronize the outcome to SuccessFactors Platform

  • 2620429 - How to - Creating a Business Rule to Calculate Service Length Using Custom Field (custom-double) in Employment Details

  • 3438482 - How to Create a Business Rule to Calculate User hire date Age Based on Current Hire Date

Keywords

KBA , LOD-SF-EC-EMP , Employment Information (Employment Details) , How To

Product

SAP SuccessFactors HXM Core 2311

Attachments

Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png
Pasted image.png