Script to create worklog automatically based on technicians leave

Script to create worklog automatically based on technicians leave

You need to install Python to achieve the below. You can follow this link to install Python.

(A) Create two incident additional fields with Date/time property as below:
1) Start Date 
2) End Date





Associate these additional fields in your Request Templates.
- Create a request Status (Admin -> Status) with name Leave

(B) Set your Operational hours. Ex -  between 9.00 AM and 6.00 PM ( Path - Admin -> Operational Hours


(C) You can add your organization wide holidays by pathing to the Holidays option (Path - Admin -> Holidays ) the dates of his holidays needs to be entered and saved. 



(D)=> Download the attached files and paste it under -> ManageEngine\Service Desk\integrations\Custom scripts.
1) - Now Edit the worklog_MSP.py file and Search and Modify the below -> Holidays(Its the date of your holidays configured in our application), and your usual operational Hour start time and end time in the same format as present in your system. 

startdate_udf and enddate_udf == Refer to API field name in your set up (refer first image) and provide the same in the relevant place.



2) - Similarly Configure the URL (Product Hosted URL) and technician key by editing the Configuration.json. (from the attachment)  

You need to generate technician key by login as administrator -> Click on User Profile in the top right -> Click Generate API Key. Now generate a key and provide it under the technician key place holder.

3) Place the worklogcreation.txt file under ManageEngine\Service Desk\integrations\Custom scripts\executor_files

(E) After doing this you need to create a custom trigger as shown in the below image.  (Admin -> Custom triggers) 




-> Post doing this , technicians who are planning for vacation needs to create a ticket. They should set the status as Leave and Start date and End date of their leave.
-> Once done , a ticket will be created along with worklogs for the mentioned dates.