Adding an approval automatically with a custom trigger

Adding an approval automatically with a custom trigger

Hi,

I've tried following this guide:

https://www.manageengine.com/products/service-desk/help/adminguide/configurations/helpdesk/sample-approval-scenario.html

...to create a script that automatically Assings an approver, when we use a specific incident template.


The custom trigger runs when edited/created and subject starts with "RFC". It executes the following script:

python rfc.py $COMPLETE_JSON_FILE


I then installed Python 3.6 in the latest version on the servicedesk-server. Didn't know if that was needed?


I used the script from here:

https://www.manageengine.com/products/service-desk/help/adminguide/configurations/helpdesk/sample-script.html

..but changed it as follows (basically removed multiple stages):


import sys
import json
import urllib
 
file_Path = sys.argv[1]
 
with open(file_Path) as data_file:
data = json.load(data_file)
requestObj = data['request']
 
detailsJSON1={}
detailsJSON1['requester']=requestObj['REQUESTER']
 
 
resultjson={}
resultjson["operation"] = []
resultjson["result"]="success"
message = "Sample Python script for adding approvers"
resultjson["message"]=message
 
operationJson={"INPUT_DATA":[]}
operationJson["OPERATIONNAME"]="ADD_APPROVAL_STAGE"
approvalArray={}
 
approvalObject=firstname.lastname@domain.com
approvalArray={"StageOne":[]}
approvalArray['StageOne'].append(approvalObject);
operationJson['INPUT_DATA'].append(approvalArray)
 
resultjson['operation'].append(operationJson)
 
print(resultjson)


But it doesn't work. Is there something obvious that I am missing?

We are running:

ServiceDesk Plus Professional ver. 9220 on Windows Server 2012 R2

Use MSSQL database


              New to ADManager Plus?

                New to ADSelfService Plus?