Customize List views using Client Script
Hello everyone!
In this post,
- What is a List View?
- Use Case - To hide all public views except one
- Solution using Client Script
- Other ZDKs available to customize List Views
- Summary
- Related Links
1. What is a List View?
A List View is grouping of records based on a defined set of criteria. List Views are beneficial for displaying customer specific data according to your business requirements. For example, you may be interested in following-up on the leads created during the last week or reviewing overdue tasks. The best way to handle these scenarios is to filter the records using the list views.
Click here for more details on List Views.There are two types of List Views in Zoho CRM -
- Standard List Views : You can modify the standard views and sort the order of the columns in the list.
- Custom List Views : You can create, modify, and delete custom views, and you can also sort the order of the columns in the list.
Often, there are business requirements where you need to customize these views, like hiding a view from certain users or masking a particular column in the view. Let us see how to control the list views visible to a user, using Client Script.
2. Use Case - To hide all public views except one
Zylker is a manufacturing company that uses Zoho CRM. A Salesman creates records in the custom module named "Orders".The name of the profile assigned to a Salesman is "Sales". The Admin does not want the "Sales" profile users to view the standard public views except the "My Orders" public view.
3. Solution using Client Script
Admin should remove the visibility to all public views for the profile "Sales" and permit only the "My Orders" view. Here are the list of steps to be followed.
- Create a Client Script for List Page (Standard) of Orders module and specify the event as onCustomViewLoad. To know more about how to create a Client Script, click here.
log(ZDK.Page.getComponent("list-custom-view").getOptions());
|
- Then, getOptions() will return the options in the component of List Page. Here the component is 'list-custom-view'.
- Now with the copied id of "My Orders" view , use "getComponent.setOptions()" and add the only option on list-custom-view as "My Orders" view, if the profile is "Sales".
var user = ZDK.Apps.CRM.Users.fetchById($Crm.user.id); if (user.profile.name != 'Sales') { ZDK.Page.getComponent("list-custom-view").setOptions([{ id: "5575270000000876021" }]); }
|
- You can now see that only "My Orders" view is visible for the "Sales" profile, and all other public views are hidden.
- For other profiles like Manager and Admin, all public views will be visible as shown below.
We are working on the other components in the List Page, and will let you know once they are live.
4. Other ZDKs available to customize List Views
- freezeColumns(option) - You can freeze list view and disable modifying columns.
- maskField(field_name, (length,character,reverse)) - You can mask fields in the List View
- sortByField(field_name, option) - You can sort field in the List View
- getRecords() - You can get Records in the List View
- selectRecords(criteria) - You can select Records in the List view by criteria
- selectRecordsByID(ids) - You can select Records in the List view by record ID
- clearSelection() - You can clear selected Records in the List view
- style(style_config, criteria) - You can style Records in the List View. Click here to view the related Kaizen post.
- setValue(value) - You can set the component value in the Page
- getValue() - You can Get the component value in the Page
- setVisibility(value) - You can set visibility of the component in the Page
5. Summary:
In this post, we have discussed,
- About standard and custom List Views.
- How to control the visibility of List Views using Client Script.
- How to fetch the list of views available for a module using Client Script.
- How to set your desired views for users using Client Script.
- ZDK methods available in Client Script to customize List views
6. Related Links
Kaizen Collection :
We hope you found this post useful. We will meet you next week with another interesting topic!
If you have any questions, let us know in the comment section.
Cheers!
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.