- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 07:17 AM
HI,
Use case: We have a choice list which has 5 values and i have given on load client script to remove option from the choice list depending upon roles. This is working fine on the form. But on the list view i am able to see all the choice values.
Is there a way we could hide the values on list view depending upon roles.
-Vignesh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 04:06 AM
I would suggest a new Client Script that runs onLoad.
function onLoad() {
//who to display it for - admin
var isAdmin = g_user.hasRole('admin');
if (!isAdmin){
g_form.removeOption('contact_type', 'integration');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 08:52 AM
Already mentioned above. - create an ACL with the list_edit operation to prevent users from editing that field on the list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 07:52 AM
Hello Vignesh,
For the list view, in terms of selection, it is all or nothing.
- Prevent users from editing the choice field via a list_edit ACL
- Disable list editing for the list
- Create a business rule to prevent users from setting the choice values. Validation will be based on roles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 03:18 AM
is it a good practice to write onload as well as oncelledit both the scripts to achieve the functionality?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 11:17 AM
You can do what you want by creating a global business rule named table_fieldGetChoices() and then adding the function
function table_fieldGetChoices() to that business rule.
Do a search for Business Rules that contain getChoices in the name for examples.
For example:
function incident_stateGetChoices() {
answer.add("A","a");
}
Will give the the a option in the list.
Hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 04:06 AM
I would suggest a new Client Script that runs onLoad.
function onLoad() {
//who to display it for - admin
var isAdmin = g_user.hasRole('admin');
if (!isAdmin){
g_form.removeOption('contact_type', 'integration');
}
}