Script for keeping note of employee leaves

Script for keeping note of employee leaves

Requirement:
Employees must be able to initiate a leave request while viewing their available leave days.

UseCase:
The HR department must review all requesters' outstanding leave days and leave requests before approving the leave request.

Two user defined additional fields have to be added to all requesters, one to keep track of their eligible leave count and the other to keep track of their compensation off count.

Steps to Configure:
  1. Create two numeric user additional field to hold the count of eligible leaves for every user. Populate this with the desired count for each employee.
  2. Create a new field to store the type of leave.  In our example, we have compensatory off and eligible leave.

  3. Create an extra field to hold the number of working days for which the employee intends to apply for leave.
  4. Create a new leave request template and include these newly created field to indicate the type of leave and number of leaves.
  5. Configure Approvals in the request template workflow. 
  6. Goto Admin > Developer Space > Global Function > Copy & Paste the attached GF_4 - Configuration.txt and save it with a name.
  7. Goto Admin > Developer Space > Request Custom Function > Copy & paste PTO_COMP_leave.txt and save it with a name.
    • Update the global function count according to your instance.  In my case it's global_function_4().  
  8. Configure a custom trigger to get invoke this custom function script on request approval.

                    New to ADSelfService Plus?