pinfo = zoho.crm.getRecordById("Invoices",id.toLong());
pr = ifnull(pinfo.get("Product_Details"),"");
info pr;
for each p in pr
{
pid = p.get("product").get("id");
kucun = ifnull(p.get("quantity_in_stock"),"0");
if(kucun <= 5)
{
mm = Map();
mm.put("ilack",true);
res = zoho.crm.updateRecord("Products",pid,mm,{"trigger":{"workflow","blueprint","approval"}});
info res;
}
}
流程:
创建发货单 → 添加产品 → 函数检索产品库存数量 → 更新产品记录 → 触发产品工作流 → 发送邮件通知
创建两个工作流 ,一个产品模块的邮件通知 (模板),一个 自定义字段(产品模块)