SAP Knowledge Base Article - Public

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

Symptom

You wish to calculate a Service Length Using a Custom Field and maintain this information in the Employment Detail Information Portlet

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

Environment

Employee Central - Business Rules

SAP SuccessFactors HCM Suite

Resolution

This kind of calculation is possible with Employee Central, on instances without Employee Central such calculation will not be possible.

Step 1:

  • Go to Manage Business Configuration
  • Click on employmentInfo
  • Select Custom-double
  • Save

As seen below

1service.png

Step 2: Grant a Permission

  • Open the Permission Role for user whom you like to grant access to all jobs.
  • Click on Permission
  • Under Employee Data: Grant Permission
  • Click on Save Changes.

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

  1. Create Rule - View in Edit Mode

    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.

    View Rule

    Step: Add Rule to Manage Business configuration or BCUI

    • Go to Manage Business Configuration
    • Click on employmentInfo
    • Select above rule
    • Save

    View Code in Succession Data Model XML

    <hris-element id="employmentInfo">

    <label>Employment Details</label>

    <label xml:lang="en-US">Employment Details</label>

    <trigger-rule event="onView" rule="calculate_a_Service_Length "/>

    Example:

    • Hire date: Jan 1, 1996 
    • Length of service Today: Dec 10, 2025

    PS: Do not use model rules, please use employmentInfo (Employment Details) base object.

    Other option: 3652095 - Create a Business Rule that Calculates and displays a Custom field in the Format X Years Y Months

    FAQ - Additional Information

    Q) Where can I get information on this from the Guide?

    A) Guide:Implementing Employee Central Core   /     Chapter:Rule Scenarios for Employee Central Core

        Guide: EC Standard field  Guide: Data Model Field Information for Employee Central -

    Q) Can I run a report on transient field?

    A) Just a quick note on onView calculated fields:

    • Calculated fields are transient fields, meaning they are not stored in the database.
    • Instead, values are calculated dynamically each time you view a user’s Biographical Information.
    • Because of this, these fields are not supported for reporting and will not be available in reports when the rule is set to trigger onView.

    See Also

    • 3652095 - Create a Business Rule that Calculates and displays a Custom field in the Format X Years Y Months

    • 2345108 - How to - Creating a Business Rule to Calculate Age
    • 3652095 - Create a Business Rule that Calculates and displays a Custom field in the Format X Years Y Months
    • 2577292 - How to calculate age on a specific event date in Online Report Designer?
    • 2283381 : Calculated / Transient fields are inconsistent or blank in reporting.
    • 3003502 : MDF object Transient Field is not Reportable in Adhoc Report and Advance Reporting (Report Canvas) Reports.
    • 2339132 - Is it possible to create a report on "Compa Ratio and Range Penetration" - Report Table
    • 2559179 - Compa Ratio and Range Penetration report - Advanced Reporting
    • 2283381 - Calculated / Transient fields are inconsistent or blank in reporting
    • 2602486 - Rule trace not capturing logs for all rules 
    • 2472648 - Check Tool: How to check your SuccessFactors configuration
    • 3319018 - How To Enable Feature Data Inspector
    • 3091459 - Service Layer Logger FAQ

    Keywords

    Business Rules, Calculate Service Length, Custom Field, custom-double, Employment Detail, Years of service, seniority, Age, Calculated , Transient fields, use base object,Trigger onView Rules for HRIS Elements , KBA , LOD-SF-EC-EMP , Employment Information (Employment Details) , LOD-SF-PLT , Platform Foundational Capabilities , LOD-SF-EC-PER , Person Data (All Person Data Types) , LOD-SF-EC-ROD , Advanced Reporting (Employee Central ODS/ORD) , How To

    Product

    SAP SuccessFactors Employee Central all versions