Restrict available options to a dropdown field in a list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 04:37 AM
In a list view for task records, i.e Open Incidents, the State field is one of the valid columns.
In various forms using the State field we are using Client Scripts to hide options like Resolve and Close. We do not set those option to inactive in the sys_choice table, because if we do then we can't select them in Report filters etc.
We are also using UI Policies and ACL's to restrict or allow various actions to the State field.
However, when it comes to list views, the State field is wide open. Meaning that the users can by double clicking it actually Resolve or Close the Incident.
And in our Processes we do not want to allow that from lists.
So today we have a list_edit ACL that restricts any update to the State field.
What we want to achieve is to allow some of the options to be available for the user, and options like Resolve and Close to be hidden. But so far we have not found any method for this in list views.
Anyone that can help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 04:57 AM
Hi Tor,
When we restrict user's for any option visibility on form, it appears for list view also. Here even though those options are visible in list view, the saved option in it will not save.
Check with users on Form, if it is restricted then try with list view and check whether option is saved ?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 05:18 AM
Thanks for your answer Abilash
With users on Form the Resolve and Close options are not available.
In list view they are available.
When selecting i.e Resolve in list view, the record is saved as Resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2016 03:08 AM
You can restrict the users from updating the field with not required values by creating a onCellEdit client script as follows:
For example:
Table name : incident
Field name : State
Restrict the user from selecting the close option.
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
var isAdmin = g_user.hasRole('admin');
if (!isAdmin && newValue == 7){
alert('Not allowed to set this state');
saveAndClose = false;
}
callback(saveAndClose);
}
Hope this helps!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 03:37 AM
Thank you Sasiaknth
I tried the same script before I posted this question, and actually it does not work quite well in list view in Helsinki.
Anyway we have now decided to totaly block the users from updating State from a list. We are doing this with an ACL.
So far for any methode we have tried, the users will see options like Resolve and Close, and we do not want that.
Also the onCellEdit script will show these options, and we think it is not good practice to give these options to the user, and then tell him that he can not use them.
Thanks