Requirement
Autopopulate Zoho Creator field with employee information stored in Zoho People.
Use case
Let's assume an organization named Zylker has a private library. The regular users must purchase a membership in order to access the library, however, Zylker employees can use the library free of cost. Zylker uses Zoho People to manage their employees and a library management Zoho Creator app to manage the library. On entering the Zylker employee ID in the Borrow Resource form which is used to loan books from the library, the employee's name will be fetched from Zoho People and auto populated in the Zylker Member field.
Steps to follow
Form | Form Link Name | Field Type | Field Name | Field Link Name |
Add Member | Add_Member | Number | Member ID | Member_ID |
Name | Name | Name |
Phone Number | Phone Number | Phone_Number |
Address | Address | Address |
Borrow Resource | Borrow_Resource | Radio | Are you a Zylker employee? | Are_you_a_Zylker_employee |
Lookup (Add Member) | Member | Member |
Single Line | Employee ID | Employee_ID |
Single Line | Zylker Member | Zylker_Member |
Single Line | ISBN/Barcode | ISBN_Barcode |
Date | From Date | From_Date |
Date | To Date | To_Date |
4. Click Add New Action and select Deluge Script. Add the below code:
- hide Employee_ID ;
- hide Zylker_Member ;
- hide Member ;
6. Click Add New Action and save the following Deluge snippet in the Deluge editor. This script dynamically shows/ hides Employee_ID, Zylker_Member, and Member fields.
- if(Are_you_a_Zylker_employee == "Yes")
- {
- show Employee_ID;
- show Zylker_Member;
- disable Zylker_Member;
- hide Member;
- }
- else if(Are_you_a_Zylker_employee == "No")
- {
- show Member;
- hide Employee_ID;
- hide Zylker_Member;
- }
8. Click Add New Action and save the following Deluge snippet in the Deluge editor.
- // Fetch the Zoho People record that matches the inputted employee ID using Zoho People -Get Records integration task
- searchMap = Map();
- searchMap.put("searchField","EmployeeID");
- searchMap.put("searchOperator","Is");
- searchMap.put("searchText",Employee_ID);
- response = zoho.people.getRecords("P_Employee",0,1,searchMap,"people_connection");
- // Populate the Zylker_Member field with the fetched value
- Zylker_Member = response.get(0).get("FirstName") +" "+ response.get(0).get("LastName");
See how it works
- Zoho People integration task
- Show/Hide fields
- Disable fields
- Connections