deal = zoho.crm.getRecordsbyId("Deals",dealid);
items = deal.get("Items");
The meat of the script starts here. Once you have your list (in this example, Items subform), do the following:
headers = " Name SKU Serial Number Quantity ";
bodytext = "";
n = 0;
Iterate through the List & Build the Table Rows
- Get the Name, SKU, Serial Number and Quantity values for each element of the list.
- Insert the script that alternates row colors. You can customize the row color to anything you desire, just specify the hex code.
- At each iteration, we +1 to n.
- Then, define hex with an if condition that sets that value in an alternating pattern with the isOdd function.
- Build the table row with the bodytext variable.
- Finally, outside the loop, combine the headers and bodytext and add a command to close the table.
for each i in items
{
name = i.get("Name");
SKU = i.get("SKU");
serial = i.get("Serial_Number");
quantity = i.get("Quantity");
// This gives the table rows alternating colours
n = n + 1;
if(isOdd(n))
{
hex = "FFFFFF";
}
else
{
hex = "F3F6F9";
}
// Build the bodytext for the table
bodytext = bodytext + "" + name + " " + SKU + " " + cereal + " " + quantity + " ";
}
fulltable = headers + bodytext + "
";
info fulltable;
Book a free 30-minutes consultation with a Zoho expert or send us an email