ServiceDesk Plus

    SAMPLE SCRIPT FILE FOR SETTING APPROVERS THROUGH CUSTOM TRIGGER

     

    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']

    detailsJSON1['subject']=requestObj['SUBJECT']

    detailsJSON1['description']=requestObj['SHORTDESCRIPTION']

    detailsJSON1['priority']=requestObj['PRIORITY']

    detailsJSON1['status']=requestObj['STATUS']

     

     

    resultjson={}

    resultjson["operation"] = []

    resultjson["result"]="success"

    message = "Sample Python script for set_approval"

    resultjson["message"]=message

     

    operationJson={"INPUT_DATA":[]}

    operationJson["OPERATIONNAME"]="SET_APPROVAL"

    notesArray={}

    notesArray1={}

    notesArray2={}

     

     

    noteObject41="sampleuser1@sdplinmail.com" 

    noteObject42="sampleuser2@sdplinmail.com"

     

    operationJson['INPUT_DATA'].append(noteObject41);

    operationJson['INPUT_DATA'].append(noteObject42);

    resultjson['operation'].append(operationJson)

     

    print(resultjson)

     

    Copyright © 2017, ZOHO Corp. All Rights Reserved.