Send email notification to requester when a note is added to a request

Send email notification to requester when a note is added to a request



How it works?

A report will be scheduled to run at a periodic interval which will fetch he details of the request. Once the schedules runs, the script will fetch the values from the report and sends an notification through email to the requester of the request where the note is added. 

What is 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 Query Reports.

Create a new custom schedule with a unique Schedule Name. Mention the command to execute the script in the Executor field. Associate the required Query Reports as Arguments. Mention the Start Date & Time at when the action should take place. Schedule the action by specifying the Repeat interval. Enable/Disable a custom schedule as preferred.


Instructions 

1. Extract the attached files under ManageEngine\ServiceDeskPlus-MSP\integration\custom_scripts

2. Edit the configuration.json with the mail server details. 

3. Navigate to Reports>New Query Reports>> Run the below query 

The below query is for 10.5:

SELECT wo.WORKORDERID AS "workorderid", 
max(wo.TITLE) AS "subject", 
max(aau.FIRST_NAME) AS "Requester",
max(AaaContactInfo.EMAILID) AS "Email"  FROM WorkOrder wo LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID LEFT JOIN AaaUserContactInfo ON aau.USER_ID=AaaUserContactInfo.USER_ID 
LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID  LEFT JOIN Notes note ON wo.WORKORDERID=note.WORKORDERID  where  
note.NOTESID = (SELECT MAX(nts.NOTESID) FROM Notes nts WHERE nts.WORKORDERID=note.WORKORDERID and extract(epoch from(now()::TIMESTAMP -  to_timestamp(nts.notesdate/1000)::TIMESTAMP))/3600 < 1)  and  (wo.ISPARENT='1') group by wo.WORKORDERID

The below query is for 10.6:

SELECT wo.WORKORDERID AS "workorderid", 
max(wo.TITLE) AS "subject", 
max(aau.FIRST_NAME) AS "Requester",
max(AaaContactInfo.EMAILID) AS "Email"  FROM WorkOrder wo LEFT JOIN SDUser sdu ON wo.REQUESTERID=sdu.USERID LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID 
LEFT JOIN AaaUserContactInfo ON aau.USER_ID=AaaUserContactInfo.USER_ID 
LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID  
LEFT JOIN workorderNotes note ON wo.WORKORDERID=note.WORKORDERID   where  note.NOTESID = (SELECT MAX(nts.NOTESID) FROM workorderNotes nts LEFT JOIN notes nos ON nts.NOTESID=nos.NOTESID  WHERE nts.WORKORDERID=note.WORKORDERID) and
  (wo.ISPARENT='1') group by wo.WORKORDERID

4. Save the report. 



5 . Navigate to Admin>Custom Schedule>>> Fill the details 

The Executor field should be  py sendMailRecentNotes.py

Select the report as argument 




Whenever the schedule runs, email notifications will be sent to the requester of the request where notes are added. 




                  New to ADManager Plus?

                    New to ADSelfService Plus?

                      • Related Articles

                      • How to send custom email notifications for a request_NOT IN USE

                        This sample python script is used for sending custom notifications from ServiceDesk Plus MSP when a criteria is met.  You all know that ServiceDesk Plus MSP has notification rules and customisable templates to notify requesters, technicians, and ...
                      • Script to send notifications when a unknown request is raised

                        Use case The script will send email notifications to the address configured inside the script whenever a request is created under unknown requests.  This notification will be sent to Admin Email Pre-requisite - Python should be installed in the ...
                      • Script to Update date/time additional field inside request when note is added.

                        (Applicable for builds 14300 & above) Please follow the below mentioned steps to configure: First Download and extract the attached zip file containing the scripts & attachments (screenshots) 1.Goto Admin > Developer space --> Custom Functions > ...
                      • Notification script using Custom function in custom trigger

                        This is applicable from 10600 builds. From 10600 , Business rules dont have Email notification feature. The same use case be achieved through Custom triggers feature as mentioned below. Script to enable notification of request creation using custom ...
                      • Close the request upon adding a note.

                        Kindly follow the steps mentioned below: 1) Go to Admin >> Developer Space >> Custom Function >> Global Functions >> Copy & Paste the attached GF_Content.txt and save it with a name. Update the URL and technician key as per your instance. Refer to ...