-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtml_table.dg
27 lines (26 loc) · 1.81 KB
/
html_table.dg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if(input.Account_ID != null)
{
//if you want to style the whole table at once, start with this and append the start of the table to this first x
x = "<head><style> td { text-align: center; padding: 12px 15px; } th{background: #313949; color:#CAC7C3; text-align:center; padding: 7px 5px;}button{color:white; padding: 8px 7px; border-radius: 5px}.edit{background-color: #313949;}.delete{background-color:red }table{width: 100%; margin: 0 auto; box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); border-collapse: collapse; background-color: white;} tbody tr:nth-of-type(even){background-color:#f3f3f3;} tbody tr{border-bottom: 1px solid #dddddd;}tbody tr.active-row {font-weight: bold;color: #009879;}.delete a{color:white}.edit a{color:white}</style></head>";
//create a note in your form, and put the table structure in the notes if you want it to show up in mobile(?)
//start the table
x = x + "<table>";
x = x + "<thead><tr><th>Name</th><th>Phone</th><th>Email</th> </tr> </thead>";
x = x + "<tbody>";
//iterate through all contacts in account
getRelatedContacts = zoho.crm.getRelatedRecords("Contacts","Accounts",input.Account_ID);
for each contact in getRelatedContacts
{
getRecord = zoho.crm.getRecordById("Contacts",contact.get("id").toLong());
firstName = getRecord.get("First_Name");
lastName = getRecord.get("Last_Name");
phone = getRecord.get("Phone");
email = getRecord.get("Email");
//adds the name, phone and email. to the table row. append the x variable so it's storing it each time. Clicking the email will open your email client.
x = x + "<tr><td>"+ firstName + " " + lastName + "</a></td><td>" + phone + "</td><td><a href='mailto:" + email + "'>" + email + "</a></td></tr>";
}
//close the table tags
x = x + "</tbody></table>";
//set the note field to equal x
input.table = x;
}