how to restrict list view edit of state of change records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:18 AM
hi,
I want to restrict edit of state fields for list view where only change manager role needs to be able to see closed successful and closed with defects options in state, even the admin should not see these two options, rest of the options of the state field can be editable by anyone.
can anyone help me with this?
in the form view i have written a code for hide on form view but unable to do it on list view?
function onLoad() {
var flag = g_user.hasRole('change_manager');
if(flag != true || g_user.hasRole('admin'))
{
g_form.removeOption('state', '3');
g_form.removeOption('state', '14');
}
}
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:54 AM
i have written this code as expected its not coming for admin but now even the change manager role is not able to edit in list view of those fields?
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var canResolve = true;
var chg = g_user.hasRoleExactly('8e32ab3f0a0a3caa0059ebee9b5761e4');
if (newValue == "3" || newValue == '14' && !chg) {
//alert (chg);
alert("You cannot change the state to Resolved from the list view.");
canResolve = false;
}
callback(canResolve);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:24 AM
here it is
// function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
// var saveAndClose = true;
// var flag = g_user.hasRole('change_manager');
// if(flag != true || g_user.hasRole('admin'))
// {
// g_form.removeOption('state', '3');
// g_form.removeOption('state', '14');
// }
// callback(saveAndClose);
// }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:49 AM
Hi sai,
As mentioned by wojtek you will need onCellEdit
But i think you cannot just type that
you will have to create another client Script and select the type onCellEdit instead of onLoad.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:50 AM
thats what i did

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 06:53 AM
Oh you want to remove some options
sorry I thought you want to restrict editing of that field. let me try and implement on my side first
***Mark Correct or Helpful if it helps.***