How to send custom email notifications for a request.

How to send custom email notifications for a request.

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 other stake holders at various stages of the tickets. However, the flexibility to design and trigger a notification based on a combination of values in the request form will always drive contextual advantages in service delivery.  This can be achieved both using Request Custom Triggers / Request Custom Menu.

Use Case:  Let's assume that a support group owner intends to notify a list of users specified in "E-mail Id(s) To Notify" through email whenever a ticket with high impact is created in the group. In order to achieve this contextually, using notification rules won't help the IT admin.  Instead, a custom trigger with a criteria can be used to notify the users.

Requirements:
1. Python Installation - Please refer this link.
2. functions.py :  This package consists of all the functions that are used to handle the standard requirements of the customer.  Most repeated requirements are written as separate functions.  Depending on our usecase, we can include these functions in our script. 
3. configuration.json : This file maintains the configuration details of the installed server.  

Execution steps:    
1.  Extract the ZIP file under ..\ManageEngine\Servicedesk\integration\custom_scripts - folder.
2.  Edit the configuration.json and update the values.
3.  For Custom Triggers:  Go to Admin > Custom Trigger > give a trigger name > execute script > py send_mail.py $COMPLETE_JSON_FILE and set the criteria as "Impact=High"
4.  For Request Custom Menu: Go to Admin > Request Custom Menu > give a menu name > Action Type : execute script > py send_mail.py $COMPLETE_JSON_FILE. Invoke this script from Request Details page > Actions > Menu Name.
5.  Modify the attached script to update the mail content.  Please follow the comments added in the script.


Custom Trigger:






Request Custom Menu:




Please be advised that the Inline Images in the description of the Request and the Attachments will not be processed in this Script.