Introduction
During the implementation of Absence Management module there may have been situations where there is a need to have validations which would be applicable depending on who among (Employee, Line Manager or HR Admin) is booking the absence.
There could be some rules which will be applicable when employee tries to book a leave for himself (self-service transaction) but a different set of rules would be applicable if line manager books the same leave for his direct-reports. On same lines there could be a different set altogether when HR Admin tries to book a leave.
As of current date application allows configuring different approval rules based on the initiator but unfortunately there is no delivered configuration to achieve the same during absence booking. But, this doesn’t mean we cannot have some alternative. In this post, I would try to demonstrate how we can write custom logic within “Global Absence Entry Validation” Fast Formula to ensure different messages are displayed depending the user ( Employee / Manager / HR Admin).
So, without further delay let’s get started with a worked-out example.
Worked Out Example
Before we start with the demonstration we would need to ensure we have some basic pre-requisite steps are in place. They are:
- Creating a User-Defined Absence Type
- Creating Custom Error Messages which would be displayed during absence recording.
- Create a Fast Formula of “Global Absence Entry Validation” type which should be associated with the absence type.
- Active login credentials of one employee, his line manager and HR Admin.
Creating User-Defined Absence Type
For this example we will create a simple absence type (named “Test Absence”). Some salient features of the Absence are:
Creating Custom Error Messages
We would create 5 custom Error Messages.
Navigation is Setup and Maintenance -> Manage Messages -> Create Message
Messages are defined in “Absence Management” application and module is “Absence Recording”
Details of Message are as below:
Creating a Fast Formula
We would create a Fast Formula (TEST_DBI_VALUE).
Login Credentials
For this example we will perform all transaction on Employee (Martin Conway , Employee Number 925)
Details about various user which will be used in this example are below:
Absence Booking As Administrator
We will login as HCM_IMPL and try to book an Absence of “Test Absence” for Martin such that absence duration is greater than 45 hours. In this case we should get the common error (this is a error which would be shown for all types of users)
Now we will reduce the duration to less than 45 hours and try to book an absence.
Now we will save the transaction and if we re-submit we will get a error message which is specific to Administrator
Absence Booking as Manager
Now we will login as Bob.Boyle (who is line manager of Martin) and if we book more than 45 hours we will get the common error
Now we will reduce the duration to less than 45 hours and try to book an absence.
Now we will save the transaction and if we re-submit we will get a error message which is specific to Manager
Absence Booking as Employee (Self-Service)
We will login as Martin.Conway and try to book an absence of more than 45 hours
Now, we will reduce the absence duration to less than 45 hours and we should encounter the error that transaction is not saved.
Now we will save the transaction and if we re-submit we will get a error message which is specific to Employee (Self-Service)
Summary
So this is how we can have different error message for different type of user. We can also have a common error which would be applicable to all types of users.
Hope this was useful.
That’s all from my side, have a nice day ahead.