You can use the Set Criteria option in lookup fields to restrict the entries that will be displayed in the lookup field, based on a given criteria.
Let us take the example of the Library Manager application, which consists of the following forms:
By default, the field 'BookName' in 'IssueBook' form will display all the books present in the 'Book' form. But our requirement is to list the books with Status as 'Available' in the 'BookName' picklist field. We can easily achieve the above requirement by giving the following criteria for the look up field 'BookName'. In the screen-shot given below, the deluge criteria Status="Available", is added to the BookName lookup field.
Another widely used scenario is restricting the picklist entries based on the user who logs into the application. For example, assume that an organization has created an appraisal form to be used by managers to appraise his subordinates. When a manager logs in, only his subordinates must be available for choosing in the employee picklist. In this case, the lookup field will be the 'Employee_Name' from 'Employee' form and the 'Set Criteria' will be ManagerMailID == zoho.loginuserid, where ManagerMailID, is the deluge field name in the Employee form which holds the zoho login emailid of the manager and zoho.loginuserid returns the email id of the user who has logged into the application. Also Refer: Tips & Tricks -> Display Picklist based on loginuser.
You can dynamically add items to a picklist based on selection in a previous picklist. Let us take the sample of the Dynamic Picklist application, which comprises of the following forms:
- Country Name: Text field to enter the name of the country
- Country: Lookup field imported from the Country form
- State Name: Text field to enter the name of the States belonging to a country.
In the above criteria,