Creator Help

Iterate Records in a Picklist

The for each list value Deluge statement enables you to iterate through multiple list values in a row. For example, if there are n rows in a form and for each row there are m values in a multiple list field, you can iterate through the m values in the list within each row. - See more at: /creator/help/script/for-each-value-in-list.html#sthash.2FLTyAqC.dpuf
The for each list value Deluge statement enables you to iterate through multiple list values in a row. For example, if there are n rows in a form and for each row there are m values in a multiple list field, you can iterate through the m values in the list within each row. - See more at: /creator/help/script/for-each-value-in-list.html#sthash.2FLTyAqC.dpuf

The For each list value Deluge statement allows you to iterate through multiple list values in a picklist. The sample application “Task Management” illustrates the usage of the for each list value deluge task. The application comprises of the following three forms:

  • Staff Details: To enter the Name and E-mail id of the staff.
  • 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.

 Script

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
]

 Script Explanation

temp = "";
  • A variable named temp is declared to store the values of the tasks assigned. Initially the value of the variable temp is set to NULL. The deluge task Set Variable is used to declare the temp variable.
for each Tasks_Assigned r in Assign_Task [(Staff == input.Staff &&Assigned_Date == input.Assigned_Date)]

 where,

  • for each list value task mentioned in the above code, iterates through mulitple values in the Task_Assigned look up field of the Assign Task form.
  • criteria fetches the records of the staff name and Assigned date same as the input staff name and date.
  • r is the collection variable that holds the data corresponding to each iteration.
temp = temp + r.Task + "<br>";

 where,

  • the "temp" variable is appended with each task value.
  • r.Task will fetch the task from the related Tasks form.
rec= Staff_Details [Staff_Name == input.Staff];
  • The Fetch Record deluge task in the above code is used to fetch the records from Staff_details Form that matches the given criteria and store it in a variable named rec.
sendmail
(
To : rec.Email_Id
From : zoho.adminuserid
Subject : "Subject of the email"
Message : "The following tasks are assigned to you: <br>" + temp
)

The Send Mail task mentioned above is called to send an email to the Email ID of the staff. Here,

  • rec.Email_Id will fetch the staff email id from the rec variable.
  • Temp contains the list of tasks assigned to the staff.

 Install the application

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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com