Script Master 14: How to email pending requests list to each technician periodically

Script Master 14: How to email pending requests list to each technician periodically

Hey Guys,

Here I come with another useful script that helps to email pending requests to each technician in a periodic interval.

Thank you @Albe Louw for posting us this requirement.  

Use Case :  Say if we have 300 technicians and each one of them should be notified of their pending requests on a day-to-day basis. In ServiceDesk Plus, we may have to schedule 300 reports to send it to each one them. This script simplifies it and emails the report to every technician without having to create separate reports.

This script is written to work with the 'custom schedules' feature released with the version 9300. 

Execution Steps :

1. Install Python on the ServiceDesk server by following the below instructions.


2. Once installed, download the ScheduledReport.py script from the below link and place it in the ManageEngine/ ServiceDesk/ integration/custom_scripts folder.


3. Edit the ScheduledReport.py file and update your SMTP server details, mail server name, username and password

3. Go to Reports--> New Query Report and execute the below query and save it with the name "Pending Requests for All Technicians" under any of the available report folders.

SELECT wo.WORKORDERID "requestid",
wo.TITLE "subject",
std.STATUSNAME "status",
ti.FIRST_NAME "technician",
aci.EMAILID "email" 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 auci  ON ti.user_id=auci.user_id
LEFT JOIN AaaContactInfo aci ON auci.contactinfo_id=aci.contactinfo_id
WHERE (wo.ISPARENT='1') and std.ISPENDING='1'  and wos.OWNERID!=0 and aci.emailid !=''
order by 4

4. Go to Admin--> Custom Schedules and set up the schedule as shown below.




5. When the script gets triggered as per the defined schedule, it will send e-mails to all technicians with their pending requests.

6. Here's a sample showing what the technician(s) will receive.

 

See you all next week with another useful script. 

                  New to ADSelfService Plus?