Desk工单批量回复

Desk工单批量回复

1、演示场景:一次性选择多个工单,批量进行回复

2、实现方法:通过“宏”功能模拟按钮的效果,触发函数调用模板进行批量发送

3、函数样例:

//定义机构id
orgId = "41071068";
//获取工单信息
ticketdetails = zoho.desk.getRecordById(orgId,"tickets",id);
//从工单信息中获取客户的邮箱地址
contactemail = ticketdetails.getJSON("email");
//批量回复时调用的模板id
templateId = 7326000000007107;
//通过连接器调模板
Render = invokeurl
[
url :"https://desk.zoho.com.cn/api/v1/templates/" + templateId + "/render?entityId=" + id
type :POST
connection:"zohodesk"
];
//Map赋值,固定格式
Mappy = Map();
Mappy.put("to",contactemail);
Mappy.put("content",Render.getJSON("body"));
Mappy.put("contentType","html");
Mappy.put("fromEmailAddress",temail);
Mappy.put("channel","EMAIL");
//通过连接器模拟手动回复的效果,生成一个回复的线程
sendreply = invokeurl
[
type :POST
parameters:Mappy + ""
headers:{"orgId":orgId}
connection:"zohodesk"
];

相关参数:
id:Ticket id
temail:邮件