configuration = global_function_4();
instanceJson = context.get("instance");
portalID = instanceJson.get("id");
workorderid = requestObj.get('id');
returnObj = Collection();
url = configuration.get('url') + "/api/v3/requests/"+workorderid;
headers= {"authtoken":configuration.get("technicianKey"),"portalid":portalID};
input_data = {"request": {"request_type": {"name": "Incident"}}};
//info input_data;
response = invokeurl
[
url: url
type: PUT
parameters: {"input_data":input_data}
headers: headers
];
if ( response.get('response_status').get('status') == 'success'){
returnObj.insert("result":"Success");
returnObj.insert("message":"Field updated");
return returnObj;
}
else{
returnObj.insert("result":"Failed");
returnObj.insert("message":"Field update failed");
return returnObj;
}
//info response;
return returnObj;