Choose where you’d like to start

Deluge in Zoho People

Zoho People features that support Deluge

Zoho People supports Deluge in the following four areas:

Validation

Zoho People allows you to create validation based on one or more fields of a form. With Deluge, you can write custom logic that will be triggered on click of the submit button of a form.

Navigation to Deluge

  1. Click the Settings icon at the top-right corner.
  2. Under Customization, select Forms.
  3. Select the form for which you want to create validation.
  4. Click the Custom validation checkbox.
Example

Let's assume an organization has a policy that employees who are serving their notice period can't apply for leave. Custom validation can be used to customize the Leave form to restrict entry from the employees who are serving their notice period.

See how it works
Steps to follow

Details of all the employees serving their notice period are maintained in Exit Details form. The Leave form is used by all employees to apply for leave. Let's configure a custom validation for the Leave form.

Step 1: Navigate to Deluge
  1. Click the Settings icon at the top-right corner.
  2. Under Customization, select Forms.
  3. Select the Leave form.
  4. Click the Custom validation checkbox.

Next, let's script using Deluge to restrict submission of the form if the employee's record is found on the Exit Details form.

Step 2: Navigate to the Deluge editor
  1. Under Automate, click Edit in the Sign template card.
  2. Click the Configure Sign Collection button.
  3. In the pop-up that appears, go to the Advance settings tab, check the Execute a custom function checkbox and click Configure.
Step 3: Script using Deluge
// Construct a map to supply as criteria to Zoho People - Get Records integration task. This checks if an entry with the current employee ID is available in the Exit Details form. 
search_map = Map(); 
search_map.put("searchField", "EmployeeID"); 
search_map.put("searchOperator", "Is"); 
search_map.put("searchTextByID", employee_record_id); 

// Fetch record with the current employee ID from the Exit Details form using Zoho People - Get Records integration task. The link name for the Exit Details form in Zoho People is P_Separation. 
employee_exit_details = zoho.people.getRecords("P_Separation", 0, 1, search_map); 

// If no record with current employee ID is found in the Exit Details form, the value of 'employee_record_id' param will not be available in the response. Hence, perform a null check on the returned key. 
record_unavailable = employee_exit_details.get(0).getKey(employee_record_id).isNull(); 

// Create a collection to store error message to be displayed for employees serving notice period 
custom_message = Collection(); 

//  Insert custom error message into the 'custom_message' map only if 'employee_record_id' value is not available in the response 
if(record_unavailable == false) 
{ 
custom_message.insert("EmployeeID":"Employees on their notice period cannot apply for leave"); 
} 

// Insert the error message into a collection with key 'errors'.  
error = Collection(); 
error.insert("errors":custom_message); 
​
//Return the 'error' collection. This restrict the form from being submitted if value is available against 'errors' key.  
return error;

Workflow

Zoho People offers you a workflow automation tool that automates all your HR processes. You can associate Deluge functions on the configured workflow.

Navigation to Deluge

  1. Click the Settings icon at the top-right corner.
  2. Under Automation, select Workflows.
  3. Click the Add Workflow button.
  4. Provide the function name and select the required trigger process.
  5. Click on the plus icon next to Custom Functions under Action.
Example

Let's assume an organization allows its employees to request to resign using Exit Request form. An entry will be automatically added in Exit Details form if the request is approved by their manager. This automation can be achieved using Zoho People workflows and Deluge.

See how it works
Steps to follow
Step 1: Create a custom form

Create a form with the following details. This form is used by the employees to raise exit request.

Form NameForm Link NameField TypeField NameField Link Name
Exit RequestExit_RequestLookup (Employee)Employee IDEmployee_ID
DateSeparation dateSeparation_date

Note:

  • Mark both the fields as mandatory
  • Select the primary lookup checkbox to set Employee ID field as primary lookup.
Step 2: Set permissions

Set permission for the team members to access the Exit Request form. Click on the ellipsis (three dots) icon at the top-right corner of the form's edit page and set permission as shown below:



 
Step 3: Navigate to Deluge
  1. Click the Settings icon at the top-right corner.
  2. Under Automation, select Workflows.
  3. Click on the Add Workflow button.
  4. Provide the following details in the Add Workflow window.
  5. Click the plus icon next to Custom Functions under Action.
Step 4: Configure function arguments
  1. In the top pane of the Deluge editor that appears, enter a function name and click Edit Params. 
  2. Provide the following details in the Edit Params window. In the following step, we will use these arguments like variables in Deluge script. 

    Next, let's script using Deluge to create a new record in the Exit Details form with the employee's details and assign the approver/manager as the interviewer.
Step 5: Script using Deluge
// Construct a map to hold the criteria to search the record of the logged-in user in Employee form.  
search_map = Map(); 
search_map.put("searchField","EmailID"); 
search_map.put("searchOperator","Is"); 
search_map.put("searchText",zoho.loginuserid); 

// Use Zoho People - Get Records task to fetch the details of the logged-in user. The link name for the Employee form in Zoho People is P_Employee. 
interviewer_id = zoho.people.getRecords("P_Employee",0,1,search_map).get(0).get("Zoho_ID"); 
 
// The logged in user (approver) will be assigned as interviewer of the employee who raised exit request. Construct a map to store employee details of the interviewer. 
values_map = Map(); 
values_map.put("EmployeeID",empId); 
values_map.put("SeparationDate",seperationDate); 
values_map.put("Interviewer",interviewer_id);
​ 
// Use Zoho People - Create task to create a record in the Exit Details form. The link name of the Exit Details form in Zoho People is P_Separation. 
response = zoho.people.create("P_Separation",values_map);
Step 6: Add approval workflow

Configure who can approve the exit request submitted by employee.

  1. Click Approvals under Automation.
  2. Click the Add Approval button.
  3. Provide the following details and click Save.

    A button for approve and reject will be displayed in the record. The custom function configured in step 4 will be executed when the approve button is triggered.

Scheduler

Zoho People offers to create schedulers which will automatically perform the actions of a particular Deluge custom function, at the time specified by you.

Navigation to Deluge

  1. Click the Settings icon at the top-right corner.
  2. Under Automation, select Scheduler.
  3. Click on the Add Scheduler button.

Example

Let's assume an organization expects its employees to be considerate of their work hours. Therefore, employees' attendance will be analyzed every Sunday and intimation emails will be sent to the employees whose previous week's work hours dropped less than 48hrs. This process can be automated using Scheduler and Deluge.

See how it works
Steps to follow
Step 1: Create a connection

Create a Zoho People connection with the following details. This will be used later in the Deluge script to invoke an API.

Step 2: Configure scheduler
  1. Click the Settings icon at the top-right corner.
  2. Under Automation, select Scheduler.
  3. Click on the Add Scheduler button.
  4. Provide the following information:
Step 3: Script using Deluge
// Construct a map to supply as parameter to the Zoho People API 
query_map = Collection(); 
query_map.insert("startDate":zoho.currenttime.subDay(7)); 
query_map.insert("endDate":zoho.currenttime); 
query_map.insert("dateFormat":"dd-MMM-yyyy"); 
query_map.insert("sIndex":"0"); 
query_map.insert("limit":"200"); 
 
// Invoke the Zoho People API to fetch attendance record of all employees 
get_rec = invokeurl 
[ 
url: "https://people.zoho.com/people/api/attendance/getSummaryReport" 
type: POST 
parameters: query_map.toMap() 
connection: "people_oauth_connection" 
]; 
summary_Reports = get_rec.get("summaryReport");  

// Go over each record to check the number of hours worked by each employee 
for each summary in summary_Reports 
{ 
totalWorkedDays = summary.get("totalHours"); 
totalWorkedDays = totalWorkedDays.getPrefix(":").toNumber();  

// Send an intimation email if total working hours is less than 45 
if(totalWorkedDays < 45) 
{ 
    emailId = summary.get("emailId");  
    sendmail 
    [ 
        from: zoho.adminuserid 
        to: emailId 
        subject: "Hello"+summary.get("name") 
        message: "You have worked less than 45 hrs last week" 
    ] 
} 
}
 
Note:
  • This API can only fetch upto 200 records. To fetch more than 200 records, you'll need to make multiple API calls.
  • Please make sure the number of API calls required would fall within your API limit.

Custom Button

 

Zoho People supports custom buttons for different actions making the system more flexible and forms more customizable. You can achieve custom automations by associating a Deluge custom function to these buttons.

Navigation to Deluge

  1. Click the Settings icon at the top-right corner.
  2. Under Customization, select Custom Action.
  3. Click the Add Custom Action button.
  4. Provide the required details as configure where the button has to be displayed.
  5. Under Criteria Based Action (or) Default Action, click the plus icon next to Custom Functions.

Example

Let's assume when a company's assets are given to the employees, an entry will be added in the Add Asset form. Upon returning the asset, the administrator updates the return date field and sends a confirmation email to the employee. This process can be automated using Zoho People's custom button and Deluge.

See how it works
Steps to follow
Step 1: Navigate to Deluge
  1. Click the Settings icon at the top-right corner.
  2. Under Customization, select Custom Action.
  3. Click the Add Custom Action button.
  4. Provide the following details:
  5. Under Criteria Based Action, provide the following criteria to make the custom button work only if the return date field is empty and click the plus icon next to Custom Functions.
Step 2: Configure function arguments
  1. In the top pane of the Deluge editor that appears, enter a function name and click Edit Params.
  2. Provide the following details in the Edit Params window. In the following step, we will use these arguments like variables in the Deluge script.
Step 3: Script using Deluge
// Construct a map to store the values that need to be updated 
param_map = Map(); 
param_map.put("ReturnDate", zoho.currentdate); 
param_map.put("recordid", recId); 
​
// Use zoho.people.update integration task to update the Return Date field. 
response = zoho.people.update("Asset", param_map);  

// Send confirmation email to the employee  
sendmail 
[ 
    from:zoho.adminuserid 
    to:emailAddress 
    subject:"Asset Returned" 
    message:"Hello"+empName+",<br>We have received your asset. Please reply to this mail to confirm that we can format this machine.<br>Thank you,<br>Zylker System Admin." 
]
Step 4: Save the custom function and the custom action.

Related Links

Get Started Now

Execute