SDP - SDP MSP Integration using Custom Triggers

SDP - SDP MSP Integration using Custom Triggers

This article helps users to integrate ManageEngine ServiceDesk Plus (SDP) - ServiceDesk Plus MSP (SDP MSP) using Custom triggers and Custom Schedules feature. 

This is compatible with SDP Build - 11113 and SDP MSP Build - 10507

This will help the MSP users, whose client organization is using SDP and they will contact MSP organization (who is using SDP MSP) to handle L2 kind of tickets or some category of tickets which are outsourced to an MSP. 

Following integration cases are handled in this script.

1. When a ticket is created in SDP , the same will be created in SDP MSP under a specific account. (One-way sync)
2. When a ticket is edited in SDP , the same will be updated in SDP MSP. (One-way sync)
3. When a note is created in SDP , it will be created in SDP MSP using custom schedules (sync will happen one hour once)
4. When a ticket is resolved in SDP MSP , the same ticket will be updated in SDP. (One-way sync)


Pre-requisites :

1. A technician with the name "MSP technician" needs to be created in SDP with login.
2. The field update will happen only if both instances have a similar configuration. Like if SDP has a priority name High, then the same priority name should be there in the SDP MSP priority. Similarly, other request fields should be present. If not, only the ticket will be created in SDP MSP and the respective request field will not be synced in SDP MSP.
3. Reachability should be there between the SDP and SDP MSP instances such that the API calls to work.
4. Request closure rules should be turned off , so that when the MSP technician set the status as Resolved in SDP MSP , the same will be updated in SDP's ticket.
or Use Field and form rules and update the mandatory fields once the technician is assigned with MSP technician name in SDP instance.
5. You should have Python to be installed in both SDP and SDP MSP installed machines.

A short guide on setting up python is available here 

6. You need to execute the below query in SDP's database before proceeding.

Query for Conditionless criteria:
update globalconfig set paramvalue = 'true' where category='CUSTOM_TRIGGER' and parameter='IS_EMPTY_CRIT_ALLOWED';

How does Integration work?


1. When a SDP's ticket is assigned to a technician with the name "MSP technician", using custom triggers the API call will be made and that ticket will be created in SDP MSP. (request conversations between SDP and SDP MSP will not be synced)
2. The Reference MSP ticket ID will be updated in SDP respective ticket Say field name - "MspID"
Similarly, the SDP reference ticket ID will be updated in MSP respective ticket say field name - "sdp_ticketid".
3. Tickets that fall under the above criteria will get created under an SDP MSP Account which is configured in the file mentioned below (in steps).
4. If the Ticket's requester name is already there in SDP MSP instance under that account it will be assigned with that requester. Else it will create a new requester name under the configured account.  
===========================================

Integration flow as below :


1. Download the attached Integration-files.zip

Unzip it in a safe location. It consists of a couple of folders.
a. SDPfiles - Paste the files present inside it under <\ServiceDesk\integration\custom_scripts>
b. SDPMSP-files - Paste the files present inside it under <\ServiceDeskPlus-Msp\integration\custom_scripts
c. configuration-assistance - Consists of images (screenshot) which you can refer to configure the application. 
Refer to these screenshots while following the steps mentioned below.


Below three scripts are to be configured in the ServiceDesk Plus Instance.

Script 1: Custom trigger to create a request in MSP
Script 2:  Custom trigger to update fields in SDPMSP.
Script 3: Custom schedule to create notes in SDPMSP.


Script 4 has to be configured in the SDP MSP instance.
=======================================================

Script 1: Custom trigger to create a request in MSP

Script file : msp_create_request.py

Set a custom trigger in SDP.
technician is --> MSP technician

If Trigger is executed, new request should be created in SDPMSP with the below details.

Requester
Category
Title
Priority
Level
Description
SDP ticket id - Additional field

After creating request in MSP, In SDP we need to update the SDP MSP ticket id in an additional field.

Steps : 
1.Download the contents and paste it under \ManageEngine\ServiceDesk\integrations\Custom_scripts.
2. Configure a custom trigger in the SDP. Refer to the attached screenshot.(custom trigger configuration msp_create_request)

py msp_create_request.py $COMPLETE_V3_JSON_FILE

3. Modify the MSP additional field API name in the configuration_MSP.json. Refer to the attached screenshot. (Additional field configuration).
You can get the additional API name under Admin --> Incident additional field. Refer to the screenshot (Additional field configuration SDP)
4. Modify the SDP additional field API name in the configuration_MSP.json. Refer to the attached screenshot. (Additional field configuration)
You can get the additional API name under Admin --> Incident additional field
Refer to the screenshot (Additional field configuration SDP)
5. In the configuration_MSP.json, configure SDP MSP URL, account name, and technician key.
6. In the configuration.json, configure the SDP URL and technician key.

PS : configuration.json,configuration_MSP.json and functions.py are present in SDP files folder and SDP MSP files folder. Both need to be updated with the same set of details as said above.

Technician key --> Click the top right (login image) - Use API key generation to generate the Technician key. (from both SDP and SDP MSP) 


Script 2:  Custom trigger to update fields in SDPMSP.

Script File: update_MSP_request.py

Steps: 
Configure custom trigger in SDP to update fields. Refer to the screenshot (custom trigger configuration update_MSP_request)
py update_MSP_request.py $COMPLETE_V3_JSON_FILE

----------------------------------------------------------------------------------------------------------------------------------
Script 3: Custom schedule to create notes in SDPMSP.

Script file: add_note_msp.py

SDP query criteria  --> Criteria is MSP_ID != null and  Status not closed and (current time - last note added date) < 1 hour

PGSQL database 

SELECT wo.WORKORDERID "workorderid", 
max(wof.UDF_CHAR3) "msp_id",
max(case when note.ispublic='1' then 'true' else 'false' end) "ispublic",
max(cast(note.NOTESTEXT as varchar)) "notestext"  from WorkOrder wo 
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID 
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID  
LEFT JOIN Notes note ON wo.WORKORDERID=note.WORKORDERID 
left join aaauser on note.userid=aaauser.user_id 
left join workorder_fields wof on wo.workorderid=wof.workorderid  
where std.ispending='1' and 
wof.UDF_CHAR3 is not null and  
note.NOTESID = (SELECT MAX(nts.NOTESID) FROM Notes nts WHERE nts.WORKORDERID=note.WORKORDERID) 
group by wo.WORKORDERID having (CAST(EXTRACT(EPOCH FROM now()) * 1000 AS BIGINT)-max(note.notesdate))/1000/60/60 < 1

Steps:
1. Go to Reports tab --> New query report --> copy the query to the query editor and run the report. Save the report in the folder. 
2. Configure a custom schedule in SDP. Refer to the attached screenshot (Custom schedule add_note_msp)
py add_note_msp.py

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Script 4: When the status of a ticket in SDMSP is changed to “Resolved” change the Status in SDP to 'Resolved' and change technician name in SDP

Script File: update_technician_sdp.py

Steps:
1. Configure the custom trigger is MSP with the criteria status = Resolved. Refer to the attached screenshot(Custom trigger MSP update_technician_sdp)
2. Change the technician's name in the script. Refer to the attached screenshot (SDP Technician name in script)

py update_technician_sdp.py $COMPLETE_JSON_FILE

Please contact support@servicedeskplusmsp.com for any assistance.





          • Related Articles

          • SDP-SDPMSP integration

            This document is to understand the integration possibilities between ServiceDesk Plus (SDP) and ServiceDesk Plus-MSP (SDP MSP) helpdesk applications : What data will be synced between SDP and SDP MSP?  Data created/updated in SDP will be synced with ...
          • Script to add worklog using custom schedule

            What is a 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 ...
          • Integration with other helpdesk tools

            Please note that, we do not have direct integration of SDP MSP with other HelpDesk tools like ServiceNow. However if any HelpDesk has APIs for all Create, Update, Close operations, then you can make use of the our APIs and custom triggers to achieve ...
          • How to use Webhooks in SDP MSP

            Here is the sample integration using Webhooks feature in SDP MSP. Please refer it for more details. https://writer.zohopublic.com/writer/published/akupace4382651aa54772b5a3fb729fe1b439
          • SCP, SDP and MSP Differences

            Though ManageEngine has multiple HelpDesk applications, they are developed and targeted for Different markets. Here are few cases to understand the difference between them. HelpDesk Applications in ManageEngine (ME) are as follows :  1. SupportCenter ...