One powerful technique in Zoho Creator is to have a custom action that you can trigger on multiple records by ticking the checkboxes and then unleashing the custom action. I had a client ask me to do the same thing in Zoho CRM, i.e.
I couldn't figure out how to do this initially as the docs only mention how to do it with one record at a time but after a bit of debugging and support from the CRM team, I discovered the solution. When multiple records are selected, the IDs get sent as a pipe delimited string:
Knowing that, it's simple to write a corresponding custom function. You just have to turn the string into an array of IDs with this code IdsList = input.IdsStr.toList("|||");
Here's a sample function the Zoho team gave me:
string custombutton.SendMassEmail(string IdsStr) {
IdsList = input.IdsStr.toList("|||");
for each IdStr in IdsList
{
operationsDetails = zoho.crm.getRecordById("CustomModule1", IdStr.toLong());
sendmail
(
To : "oron@guaranteetickets.com", "ziv@guaranteetickets.com"
From : zoho.adminuserid
Subject : "Order " + orderid + " : Address for Delivery"
Message : "Order ID: " + orderid + " <br />\n<br />\nRecipient Name: " + recname + "<br />\n<br />\nMobile: " + mobile + "<br />\n<br />\nDelivery Address: " + street + " " + zip + " " + city + "<br />\n<br />\nHotel Name: " + hotelname + "<br />\n<br />\nProduct: " + qty + " x " + prodname
)
}
return "Success";
}
I couldn't figure out how to do this initially as the docs only mention how to do it with one record at a time but after a bit of debugging and support from the CRM team, I discovered the solution. When multiple records are selected, the IDs get sent as a pipe delimited string:
Knowing that, it's simple to write a corresponding custom function. You just have to turn the string into an array of IDs with this code IdsList = input.IdsStr.toList("|||");
Here's a sample function the Zoho team gave me:
string custombutton.SendMassEmail(string IdsStr) {
IdsList = input.IdsStr.toList("|||");
for each IdStr in IdsList
{
operationsDetails = zoho.crm.getRecordById("CustomModule1", IdStr.toLong());
sendmail
(
To : "oron@guaranteetickets.com", "ziv@guaranteetickets.com"
From : zoho.adminuserid
Subject : "Order " + orderid + " : Address for Delivery"
Message : "Order ID: " + orderid + " <br />\n<br />\nRecipient Name: " + recname + "<br />\n<br />\nMobile: " + mobile + "<br />\n<br />\nDelivery Address: " + street + " " + zip + " " + city + "<br />\n<br />\nHotel Name: " + hotelname + "<br />\n<br />\nProduct: " + qty + " x " + prodname
)
}
return "Success";
}
Comments
Post a Comment