relatedcontroles = zoho.crm.getRelatedRecords("Contact_Roles","Deals",input.dealId.toLong()); salutation = "<p>Hello!!<br /><br /></p>"; signature = "<br /><br /><p>Best Regards,<br />Patricia Boyle</p>"; sub = input.emailSubject.toString(); str = input.emailContent.toString(); str = concat(salutation,str); str = concat(str,signature); for each role in relatedcontroles { emailAddress = role.get("Email"); info emailAddress; sendmail [ from :zoho.adminuserid to :emailAddress subject :sub message :str ] } |
relatedcontroles = zoho.crm.getRelatedRecords("Contact_Roles","Deals",dealId); contactroles = invokeurl [ type :GET connection: "connection_name" ]; roles = contactroles.getJson("contact_roles"); roles_id = List(); for each name in roles { role_name = name.getJson("name"); role_id = name.getJson("id"); if(wanted_roles.contains(role_name)){ roles_id.add(role_id); } } info roles_id; emails = List(); for each roleid in roles_id { for each record in relatedcontroles { if ( record.get("Contact_Role") == roleid ) { emails.add(record.get("Email")); } } } info emails; p = contactroles.getJSON("body"); template = invokeurl [ url :"https://www.zohoapis.com/crm/v4/settings/email_templates/" + email_template_id type :GET connection: "connection_name" ]; econt = template.getJson("email_templates").toMap().get("content"); sub = template.getJson("email_templates").toMap().get("subject"); u = template.getJSON("body"); for each email in emails { sendmail [ from :zoho.adminuserid to :email subject :sub message : econt content type :HTML ] } |
Writer is a powerful online word processor, designed for collaborative work.