Automation of Entry Dates and TimeIn Calculation on Custom Fields for Job Information
This is my first blog on SAP. Hope this will find useful & effective in your SuccessFactors Employee Central implementation/support projects.
I will explain you how to create TimeIn Calculation (number of years/ months/days format) for custom fields in Job Information.
Assume EC Consultants are aware of what is TimeIn Calculation, transient value and how to initializing New Entry Date Fields. If you are not aware, please refer below links for more details on this topic:
- Setting Up Entry Dates and TimeIn Calculation
- Initializing New Entry Date Fields in Existing Job Info Records
As you all are aware that to calculate or filled standard transient field (time in job, time in position etc.) a job in provisioning system need to schedule. But with custom field (mentioned below) there are no such provision in SuccessFactors. I will explain in this blog, how to overcome this issue when customer needs such calculations. Let’s discuss first what kind of requirements will be and what will be the solution:
Requirement: Customer wants you to create below 2 new fields on Job Information:
- Grade Entry Date– Grade Entry Date will be filled automatically when Pay Grade on Job Information is changed or created.
- Time in Grade– This field should be calculated and filled in the History UI, Employment Info page and Manager Self Service (MSS) based on Grade Entry Date, in Years/Months,/Days format.
Let’s discuss on solution for above requirements. As per my experience above requirement can be resolved by creating a complex business rule on Configure Business Rule screen. I will explain you what kind of business rule need to configure for this specific custom transient field.
Grade Entry Date:
- First create a custom field on Job Information with Data Type: DATE:
- Update RBP (as per customer requirement). Let’s provide VIEW permission to everyone as I want this field to be filled automatically based on business rule.
- Create a business rule to fill Grade Entry Date. I need to fill Grade Entry Date on History UI, Employment Info page and Manager Self Service (MSS) based on Pay Grade:
– Create a new business rule, name it “SET_JobInfo_GradeEntryDate”
– We will use Job Information Model as a base object for this business rule
- Rule Statements:
- If Pay Grade value Is not be equal to Null AND Pay Grade Value Is Not Equal to Pay Grade Previous Value, Then Grade Entry Date field will be equal to Event Date
- Else If Pay Grade value Is not equal to Null AND Pay Grade Value Is Equal to Pay Grade Previous Value, Then Grade Entry Date field will be equal to Grade Entry Previous Value
Once above rule is configured, then go to “Manage Business Configuration” and Assign Business Rule “SET_JobInfo_GradeEntryDate” on Object “Job Information” on Field “Pay Grade”:
Time In Grade
- First create a custom field on Job Information with Data Type: STRING & Visibility=View.
- Update RBP (as per customer requirement). Let’s provide VIEW permission to Super User, Manager, Employee & HR. As value on this field should be filled automatically when Grade Entry Date will be created/updated.
- Create a business rule to fill Time In Grade:
I need to fill Time In Grade on History UI, Employment Info page and Manager Self Service (MSS) based on Grade Entry Date:
– Create a new business rule, name it “CALC_JobInfo_TimeInGrade”
– We will use Job Information Model as a base object for this business rule
– Rule Statements: As I need to fill this field as per Grade Entry Date and in “Years Months Days” format.
Let’s take an example to understand this scenario- Pay Grade of an Employee is changed on 16th Feb 2018. So Grade Entry Date will be 16 Feb 2018 and Time in Grade will be 2 Years 4 Months 23 Days. Today’s date is 11 July 2020.
Now let’s look at business rule:
As I need to fill Time in Grade in “Years-Months-Days” format. Function we will be using is Format() to format the string using template. The template is defined as %s %s %s %s %s %s. This is 6 string values. (%s – a string).
First I need to get value for “Years” and we need to round down number of years. In our scenario, it should be 2 Years (From 16 Feb 2018 to 11 July 2020). I will use below Functions:
Argument: Format Number()
Number= Difference in Years Round Down() from Grade Entry Date till today’s date.
Argument= Years. So Years as a text will be populated on field. So result will be 2 Years:
Then I need to get value for “Months” and Number of Months Round down. In our scenario, it should be 4 Months (From 16 Feb 2018 to 11 July 2020).
- First Value: I will calculate total number of months from Grade Entry Date till today’s date and divide it by 12 so result will be 28/12= 2.33
- Second Value= Difference in Years Round Down() that will be 2.
- Then I will use Minus function. First Value (2.33) Minus Second Value (2) and Multiply it with 12 (0.33 x 12= 3.96) so result will be 4 Months.
Then I need to get value for “Days”. In our scenario, it should be 23 Days (From 16 Feb 2018 to 11 July 2020). Function is Number= Round().
- First I need to get First Value= Total Number of Calendar Days from Grade Entry Date to today’s Date (874 days).
- Then I will calculate Second Value where we will get Total Number of Months from Grade Entry Date till today’s days and convert that value into Days by multiplying with 30.500 (I have used factors= 30.500 as we have different calendar days like 30, 31, 28, 29 so there might be difference in number of Days)
- Last I need to use Minus function (First Value- Second Value) so Result will be 23 Days
You can refer below complete business rule:
Once above rule is configured, then go to “Manage Business Configuration” and Assign Business Rule “CALC_JobInfo_TimeInGrade” on Object “Job Information” with OnView Event Type:
As I have already placed above rules in its respective location. Now let’s check our result:
Go to Employee Profile and check the result on Job Information portlet-
Please review the high lighted fields for the correct result (Today’s Date; Jul 11, 2020):
Effective as of: Feb 16, 2019
Grade Entry Date: Feb 16, 2019
Time in Grade: 2 Years 4 Months 23 Days
Please share your feedback and comments below.
Hi Utkarsh! your blog is very interesting!! I have tried a couple of years ago to design the same but I was in some cases getting a difference of some days up or down for the same reason you describe (if the month had 30 or 31 or 28 or 29). Does the above working in 100% of scenarios?
I came across a formula of how SAP was calculating this field for the Time in Company or other standard fields they have and the formula was quite different... but I haven't saved that to have it handy!!
Thank you for your comments.
The TimeIn Calculation is based on an average length of a month. This value has a variance of +/- 2 days, depending on the length of the actual month.
Even on standard field (Time in Job/Position/Company etc) it will have a variance of +/- 2 days as per SAP. Let me know if you need more details on this.
This was a big help Utkarsh. I encountered an error when I used 30.500 as the factor for calculating the days but was able to resolve it by using 30.41667 instead.
Thank you for the great blog. I followed all your steps. Unfortunately the rule does not work for me onview.
1st rule: Onchange of custom field set custom entry date field: This works during the hire. The caculation should follow onView of Job Information model.
2nd rule: OnView of time in custom field does not work on Job Information view.
Do I have to set the calculation on hire ?