Scenario:
A tabulated list in Zoho CRM contains all the customer orders placed with our company.
The list includes order details like: order ID, order status, customer email etc.
We want to sen an email to every customer with an order status not ‘Delivered’.
So we use a Continue statement to achieve this (shown below):
order1 = Collection();
order1.insert("id":"1000");
order1.insert("status":"Approved");
order1.insert("customer-email":"james@zylker.com");
order2 = Collection();
order2.insert("id":"1001");
order2.insert("status":"Pending");
order2.insert("customer-email":"august@zylker.com");
order3 = Collection();
order3.insert("id":"1002");
order3.insert("status":"Delivered");
order3.insert("customer-email":"betty@zylker.com");
orders = Collection();
orders.insert(order1);
orders.insert(order2);
orders.insert(order3);
for each order in orders
{
if(order.get("status")=="Delivered")
{
continue;
}
sendmail
[
from:zoho.adminuserid
to:order.get("customer-email")
subject:"Order Delay Notice"
message:"Due to the current measures to protect the safety of our distribution center employees, please expect delays in processing and delivering your order. We apologize for the inconvenience."
]
}
Assignment:
Perform the task above to auto generate the email above to both our email addresses.
http://www.zoho.com/deluge/help/list-manipulations/for-each-element.html
https://www.zoho.com/deluge/help/conditional-statements/condition.html
https://www.zoho.com/deluge/help/misc-statements/break.html
https://www.zoho.com/deluge/help/misc-statements/continue.html