CRM批量下载附件

CRM批量下载附件

File = list();//定义一个List集合
relatedrcords = zoho.crm.getRelatedRecords("Attachments","Leads","4939598000001046062");//获取记录的附件
for each  ele in relatedrcords
{
attachementId = ele.get("id");//拿到附件ID
attachementname = ele.get("File_Name");
info attachementId;
info attachementname ;
downloadFile = invokeurl
[
type :GET
connection:"crm"
response-decoding:"UTF-8"//务必添加格式为UTF-8。否则下载的附件名称为乱码
];
info downloadFile;//获取附件
File.add(downloadFile);//将附件添加到最初定义的List集合当中
}
sendmail
[
from :zoho.adminuserid
to :"chunxiao.zhang@zohocorp.com"//接收人的邮箱地址
subject :"Subject of the email"
message :"Your message"
content type :HTML
Attachments :file:File//附件
]
注:此触发动作可以在模块上添加一个按钮进行触发。批量选择记录,但不建议超过10条记录。