Creator Help

Iterate data in radio buttons and checkboxes

The “Task Management” application demonstrates the usage of the for each list value deluge task that can iterate multiple list values within each record. The application comprises of the following three forms:

  • Staff Details: To enter the staff details with fields name and E-mail id.
  • Tasks: To enter the list of tasks and its description
  • Assign Task: To assign one or more tasks to a staff on any specific date, where tasks and staff are lookup fields imported from the respective forms. When a task is assigned, an email is sent to the staff informing him about the list of tasks assigned. This is achieved using the for each list value
    deluge task that can iterate multiple list values within
    each record.
To send email to the staff with the list of tasks assigned, we will add On add ->on success script to this form, as shown below. The script uses the for each list value Deluge statement to iterate multiple list values within a record in the Assign Task form

temp = "";
for each Tasks_Assigned r in Assign_Task [(Staff == input.Staff && Assigned_Date == input.Assigned_Date)]
{
temp = temp + r.Task + "<br>";
}
rec = Staff_Details[Staff_Name == input.Staff];
SendMail
[
From : zoho.adminuserid
To : rec.Email_Id
Subject : "Subject of the email"
Message : "The following tasks are assigned to you: "<br>" + temp
]

Code Explanation

The on add ->on success script is executed whenever a record is submitted using the Assign Task form. The following code declares a variable named temp to store the values of tasks assigned and set with null value. The Set variable Deluge syntax is used to create this code.

temp = "";


Iterates through multiple values in Tasks_Assigned lookup field in the Assign Task form, with the specified criteria. The for each list value deluge syntax is used to create this code.

- The criteria will fetch the records whose staff name and Assigned Date is same as the input staff name and date.

- r is the name of the collection variable that will hold the data corresponding to each iteration of the above file name.

for each Tasks_Assigned r in Assign_Task [(Staff == input.Staff &&Assigned_Date == input.Assigned_Date)]


Append the temp variable with each task value. Again, the Set variable Deluge syntax is used to create this code.r.Task will fetch this task name from the related Tasks form.

temp = temp + r.Task + "<br>";

Fetch the record from Staff Details form with the specified criteria and store it in variable named rec. The Fetch records deluge syntax is used to create this code.

rec= Staff_Details [Staff_Name == input.Staff];


The sendmail function is called to send an email to the Emailid of the staff. Here, rec.Email_Id, will fetch the email id from the rec variable and temp will contain the list of tasks assigned to this staff.

sendmail
(
To : rec.Email_Id
From : zoho.adminuserid
Subject : "Subject of the email"
Message : "The following tasks are assigned to you: "<br>" + temp
)  

To install the application,

 Learn how to install the application to your account - click here.

Top