Function to email all Contacts related to Account in a single email?
I've successfully created a function that will email each Contact related to an Account (or Company as it is labeled), but am seeking help to improve the function. I would like to do it as a single email from the Account Owner where all contacts are in the "To" line. Is this possible? Would appreciate any help from the community.
Here's the function:
relatedcontacts = zoho.crm.getRelatedRecords("Contacts","Accounts",input.accountId.toLong());
//info relatedcontroles;
for each cont in relatedcontacts
{
emailAddress = cont.get("Email");
info emailAddress;
sendmail
[
from :zoho.loginuserid
to :emailAddress
subject :"Welcome! Let's create your account and get started!"
message : "Message"
content type :HTML