Scenario
When an employee goes the employee will give the responsibility to his supervisor. If the supervisor is also on leave the delegation is given to the head of the department. If the head of the department is also not available the delegation is given to the Administrator Person.
Solution
We have crated a custom record to store the employee who all go on leave. The if an employee goes leave he want to create a delegation record for the particular delegation period by specifying the start date and end date. The delegation will be decided based on the delegation start date. If the delegation start date is on the same day the delegation set as active on real time. Or if the delegation is created for a future day then it will be active on the scheduled basis. When the delegation is set to active an email is send to the corresponding delegating person and the time approver field of the subordinates of the person who request for the delegation will be set the value delegate person. When the delegation period is completed the status is set as Completed.
Case 1
When an employee create a delegation record same as to the current date/ less than the current date then the delegation record is created with the status as “In Progress” with the delegate person value based on the availablity of either supervisor/ div head / admin person after submitting the record. Then the time approver field of all the subordinates of the corresponding employee is set as the delegate person value. And the Stand in Approver field of the employee who request the delegation will set with delegate person value. And the check box Unable to Approve is also set as checked. Also it will send an email to the delegation person that he has received a delegation request.
During this active record creation time, if the employee has already a delegate person in any other active delegation record, we will update these delegtion records with the higher level employees based on corresponding employee. If any of the records are updated then the time approver field of the subordinates is also updated. If any time the delegating person is changed we will send an email to the delegating person.
Case 2
If an employee create a delegation record, whose delegation start date is not equal to the current date, then the delegation record is created with the status as “Planned”.
The emails and other time approver fields are set only when the delegation record is get active.
This is achieved by using a Scheduled script. This script will check if any delegation records delegation start date is Today. And then get the data and process the data in the same manner.
The delegation record is updated with the status as “In Progress” with the delegate person value based on the availablity of either supervisor/ div head / admin person after submitting the record. Then the time approver field of all the subordinates of the corresponding employee is set as the delegate person value. And the Stand in Approver field of the employee who request the delegation will set with delegate person value. And the check box Unable to Approve is also set as checked. Also it will send an email to the delegation person that he has received a delegation request.
During this active record creation time, if the employee has already a delegate person in any other active delegation record, we will update these delegtion records with the higher level employees based on corresponding employee. If any of the records are updated then the time approver field of the subordinates is also updated. If any time the delegating person is changed we will send an email to the delegating person.
Case: 3
There is also an another status called “Completed”. Once the delegation period is over we will set the status of the delegation record as Complted. Real time status updation is not considerd. That is the status is changed to Completed with the help of a scheduled script. This will chek if any delegation end date on yesterday and get the records, then empty the time approver field of the suboridates empty. And set the status as completed.
And also it will check that if any of his subordinates has an active delegation record. Then Update these delegate To values with his supervisor value. Then the subordinates time approver field is also updated with the new delegate to person value. The we will send a notification to the old delegating person as his delegation period is expired for the particular employee and a delegation request email to the new delegate person.
Once the delegation is completed set the check box “Unable to approve” as unchecked.