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.



                  New to ADSelfService Plus?

                    • Related Articles

                    • How to auto-create worklog based on values specified in the request

                      This post will to help you create a worklog automatically when a request is created. This script can be configured under Request custom triggers and you will find more information about this here. This is achieved using an API call to create a ...
                    • How to automatically create a task in a Change Request.

                      This is a sample script to create a task in a Change Request based on the values given in certain fields. This is done by using an API call to create  a task in ServiceDesk Plus. The task can also be created in a request, problem, project or a ...
                    • Script to add worklog using custom schedule

                      What is a Custom Schedule? Custom Schedules are actions scheduled on a specific date and time with or without repeat frequency. The actions are specified in a customized script file. Any data from ServiceDesk Plus can be sent to the script through ...
                    • Instruction to Change Worklog owner under All Request, worklog owner From Tech A to Tech B

                      Scenario      Worklogs assigned to Duplicate user / Incorrect user need to change all worklogs under request  to actual Technician.  Step 1 : Navigate to Report - > New Query Report and execute the below query.  Select workorder.workorderid ...
                    • Auto-create problem request based on certain criteria.

                      This is a sample script that triggers the creation of a Problem Request in ServiceDesk Plus using the Problem API.  Use Case:  ​ All incident requests with Priority = High will create a problem ticket with the request's default field values. ...