Zoho Creator : Modify picklist items dynamically

There has been requests from users like Ted Hughes for automatically filtering picklists based on selection in the previous picklist. This can be done very easily now.

Let us take a Bug Tracker application for example. It will have just three forms.

1. A form to fill in the modules. e.g. In the case of Zoho Creator, it could be user interface design, deluge script etc. See a list view of all the modules added.

list all modules

2. A second form to fill in the team member details. It has the name of the team member and the module he/she works for. See a list view of all the team members (and the respective modules).

all team members

3. And a third form for filing issues. Each of the issues filed has to be assigned to the appropriate team member. Since we have already defined the person in charge for each of the modules, it will make more sense if the items in the ‘Assigned to’ picklist gets updated every time the module is changed, listing only the relevant entries.

file issue

If ‘Persistence’ is selected in the ‘Module’ picklist, only those members of the team, in charge of the ‘Persistence’ module should get listed in the ‘Assigned to’ picklist. In this example, Edward and John should get listed.

This can be done by writing an ‘on change’ event for the ‘Module’ picklist.

Deluge code snippet:

must have Module
(
type = picklist
values = Add_Module.Module_Name
on change
{
team = team_member [Module == input.Module];
for each t in team
{
Assigned_to.add(t.name);
}
}
)


Explanation:

The code snippet given below fetches all the members of the team, in charge of the selected module.

team = team_member [Module == input.Module];

Since the variable team is an array, it has to be iterated to get the properties of each team member.

for each t in team
{
Assigned_to.add(t.name);
}

The names of those team members in charge of the ‘Persistence’ module are added to the ‘Assigned to’ picklist.

Assigned_to.add(t.name);

I have taken a very simple use case to explain this feature. But I am sure our users will exploit its full potential and use it in a lot more interesting ways to enhance their applications.

Comments

Leave a Reply

Your email address will not be published.

The comment language code.
By submitting this form, you agree to the processing of personal data according to our Privacy Policy.

Related Posts