//获取某个字段名称用于邮件主题和附件名称
a = zoho.crm.getRecordById("CustomModule13",id);
dealname = a.get("field7").get("name");
//定义集合
temail = List();
//插入收件人邮箱地址
tmp = Map();
temail.add(tmp);
//插入发件人邮箱地址,必须是机构邮箱地址
fmp = Map();
//赋值邮件各项参数
mp = Map();
mp.put("subject","测试邮件合并模板:" + dealname);
mp.put("content","商机名称:【" + dealname + "】 XXX,具体内容见附件。");
mp.put("to_address",temail);
mp.put("id",id);
mp.put("template_id","73041000002466630");
mp.put("from_address",fmp);
mp.put("attachment_name","测试邮件合并模板:" + dealname);
info mp;
//通过接口将邮件发出
datalist = List();
datalist.add(mp);
paramp = Map();
paramp.put("data",datalist);
resp = invokeurl
[
type :POST
parameters:paramp.toString()
connection:"cnuser"
];
return "发送成功!";
相关参数:
id: CustomModule13 id
附:获取邮件合并模板的id
函数样例:
resp = invokeurl
[
type :GET
connection:"cnuser"
];
info resp;
templist = resp.get("templates");
for each rec in templist
{
name = rec.get("name");
info name;
tempid = rec.get("id");
info tempid;
}