How to Automatically Associate a Ticket to a Project using PrjID based on Ticket Template

How to Automatically Associate a Ticket to a Project using PrjID based on Ticket Template

This post describes the use of a sample python script you to associate a Project automatically to a ticket during its creation/edit based on conditions, such as template matching. This script can be configured under Custom Triggers and you will find more information about this here. This is achieved using a v3 API call to in ServiceDesk Plus and therefore it is essential to check if the end user's build supports API v3. The required customization is to be performed in the first section of the script. And the $COMPLETE_V3_JSON_FILE is the argument to the script.

Use Case: The discussed scenario for which this script was requested is that the Customer has an ongoing project and whenever an incident is raised with reference to that Project, it must automatically get assigned to the Project based on a condition. The template was a condition, however, it can be modified to any additional field as well.
As of this script, the Project ID is hardcoded but can be made to be fetched based on criteria as well.

Execution Steps:
1. Download and copy the script file into the \Manageengine\ServiceDesk\integration\custom_triggers directory.

2. Update the protocol, servername and portnumber used to access ServiceDesk and the technician api key in the configuration.json.

3. Configure the script under the  Admin  ->  Custom Triggers, like shown below.



A short guide on setting up python is available here.