1. Create a Global function using the below script and save. Make sure that the application URL and Technician API key are mentioned correctly.
![](https://img.zohostatic.com/zde/static/images/file.png)
Global Function:
configuration = Map();
configuration.put("technicianKey","8AB28CFE-31EC-4047-BB4E-BA7006BDE24E");
return configuration;
2. Under Admin - > incident Management - > Request custom function, create a request custom function using the below script and save. Make sure that the Global function used in the below script is mentioned correctly as per the Global function created above.
![](https://img.zohostatic.com/zde/static/images/file.png)
Script:
configuration = global_function_4();
helpdeskID = context.get("instance").get("id");
workorderid = requestObj.get("id");
returnObj = Map();
if( !requestObj.get("resolution").get("content").isNull() &&!requestObj.get("resolution").get("content").equalsIgnoreCase("null")){
notes_content = requestObj.get("resolution").get("content");
notes_input = {
"note": {
"description": notes_content,
"show_to_requester": false,
"notify_technician": false,
"mark_first_response": false,
"add_to_linked_requests": false
}
};
response = invokeurl
[
url: configuration.get("url") + "/api/v3/requests/"+workorderid+"/notes"
type: POST
parameters: {"input_data":notes_input}
headers: {"authtoken":configuration.get("technicianKey"),"PORTALID":helpdeskID}
];
if(response.get("response_status").get("status_code") == 2000) {
returnObj.insert("result":"success","message":"Notes Added Successfully!!");
}
else{
returnObj.insert("result":"failure", "message":response.get("response_status").get("messages").get(0).get("message"));
}
}
else{
returnObj.insert("result":"success","message":"No Content to add as notes!!");
}
return returnObj;
3. Once done, create a custom trigger as shown in the attached screenshot (Trigger.png).
4. So, whenever a closed request is reopened, the content added in the resolution field will be added as a note.