Creator Help

Iterate Records in a Form

The For each record deluge task is used to iterate a particular set of records in a form. The Task Management application illustrates the usage of for each deluge task to iterate records in a form. The application consist of 3 forms.

  • Staff details - To store the Name, Email Id and Module of the staff.
  • Tasks - To store the Task Name and the Description about the Task.
  • Assign Task - To assign one or more task to the staff member. In this form, the drop-down field staff is a lookup to Staff Name field in the staff details form and Task Assigned field is the lookup of Task field in the Tasks form.

In the Task management application, the task is to send mail to each staff belonging to a specific module say "Scripting". To perform this action, we have to add the deluge script to WorkFlow --> On Add --> On Success section of the Staff Details form. The sample script mentioned below will iterate through each staff record in the Staff Details form who belong to a Scripting module and send mail to their email id with the specified message.

for each r in Staff_Details[Module == "Scripting"]
{
SendMail
[
From : zoho.adminuserid
To : r.Email_Id
Subject : "Meeting"
Message : "You are requested to attend the meeting on 22/01/2008, 3 p.m at the pacific hall"
]
}

Code Explanation

for each r in Staff_Details[Module == "Scripting"]

The code mentioned above iterates through each record in the Staff Details form whose module name is “Scripting” where,

  • r is the name of the variable that will hold the data (Staff Name) corresponding to each iteration.

SendMail
[
From : zoho.adminuserid
To : r.Email_Id
Subject : "Meeting"
Message : "You are requested to attend the meeting on 22/01/2008, 3 p.m at the pacific hall"
]

The sendmail function mentioned above is used to send an email to the staff Email Id. Here, r.Email_Id, will fetch the email id from the variable r which holds each iteration of a record.

Install the Application

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

Top