I receive the following error when trying to use the example program to change a ticket in ServiceDesk:
"Error at line : 17, 'TEXT' can not be cast to '[KEY-VALUE, TEXT, LIST]' for the function 'get'"
LINE 17:
status = result.get("status");
PROGRAM:
//Assigning value got from the Request fields to variables.These values can be used in constructing the JSON for creating the Change
requestID = requestObj.get("id");
createdTime = requestObj.get("created_time");
inputData = {"operation": {"details": {"title": "[REQ_ID-"+requestID+"] Change router software","stagename": "submission","statusname": "Requested For Information","priority": "high","description": "This is a Change request for a router software","scheduledstarttime": createdTime.get("display_value"),"servicesaffected": ["Email","CRM"]}}};
instanceJson = context.get("instance");
helpdeskID = instanceJson.get("id");
//Please update all the parameters like the ServerName , portnumber and Technician API key based on your Environment. Make sure the technician has proper roles to access the Request and Change Modules
response = invokeurl
[
url: "http://<SERVER>:<PORT>/sdpapi/change"
type: POST
parameters: {"INPUT_DATA":inputData,"TECHNICIAN_KEY":"<KEY>","format":"json","OPERATION_NAME":"ADD","PORTALID":helpdeskID}
];
info response;
operation = response.get("operation");
result = operation.get("result");
status = result.get("status");
//Messages to be printed in Request history
returnObj = Collection();
if("success".equalsIgnoreCase(result.get("status"))) {
returnObj.insert("result":"success");
returnObj.insert("message":"Change request created successfully");
} else {
returnObj.insert("result":"failure");
returnObj.insert("message":"Problem in creating change request");
}
return returnObj;
Any help is appreciated, thank you.