This post describes the use of a python script to email pending requests to each technician in a periodic interval using Custom Schedules.This showcases the use of a feature called 'Custom Schedules' that was released in the build 9300 of ServiceDesk Plus.You can find more information about what custom schedules are in the link
here.
Use Case: In ServiceDesk Plus, we may have to schedule many reports to send notification about their pending request. This script simplifies it and emails the report to every technician without having to create separate reports.
Execution Steps :
1. Go to Reports--> New Query Report and run the below query and save this report with the name "Schedulereport" under any of the available report folders.
The below report will give the list of pending request more than 10 days
PGSQL
SELECT wo.WORKORDERID AS "Request ID", ti.FIRST_NAME AS "Technician", std.STATUSNAME AS "Request Status",AaaContactInfo.EMAILID "emailid" FROM WorkOrder wo LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID
LEFT JOIN AaaUserContactInfo ON ti.USER_ID=AaaUserContactInfo.USER_ID
LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID WHERE (wo.ISPARENT='1') and std.ispending='1' and AaaContactInfo.EMAILID != '' and extract(epoch from(now()::TIMESTAMP - to_timestamp(
wo.createdtime/1000)::TIMESTAMP))/3600/24
> 10MSSQL
SELECT wo.WORKORDERID AS "Request ID", ti.FIRST_NAME AS "Technician", std.STATUSNAME AS "Request Status",AaaContactInfo.EMAILID "emailid" FROM WorkOrder wo LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID
LEFT JOIN AaaUserContactInfo ON ti.USER_ID=AaaUserContactInfo.USER_ID
LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID WHERE (wo.ISPARENT='1') and std.ispending='1' and
AaaContactInfo.EMAILID != '' and DATEDIFF(day, dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +(wo.createdtime/1000),'1970-01-01 00:00:00'),GETDATE()) > 10
2. Download and place the script file in the ManageEngine/ ServiceDesk/ integration/custom_scripts folder.
3. Edit the Configuration.json file and update your server details, Url and technician key.
4. Go to Admin--> Custom Schedules and set up the schedule as shown below.
A short guide on setting up python is available
here.