- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 09:01 PM
Hi,
I have got a requirement to hide some of the options in the "Status" field of a table based on certain roles in backend form. I was able to achieve that by using an onload client script and hide the options based on the role. This table data is with the status field is shown as an entry in the related list view and there if I expand the dropdown options, all values are coming up.
Is there way to hide the multiple choice options from the field in the related list view as well?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2024 09:24 PM - edited ‎03-05-2024 09:24 PM
Hi @janindiadoc_1 There is no way to remove choices from list layout, what you can do is you can use onCellEdit client script like below
Create OnCellEdit Client Script:
select field - State
script:
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//In Place of "3" add your choice value
if ((newValue == 3) && (g_user.hasRole('admin'))) {
saveAndClose = true; // allow to select choice
} else {
alert('Only admin can select this choice');
saveAndClose = false; // donot allow to select choice
}
callback(saveAndClose);
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 10:38 PM
@janindiadoc_1 make sure your backend value of choice are correct.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 10:40 PM
Its not even showing the alert that I have placed as the first line of the script without any condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2024 11:08 PM
Hi @janindiadoc_1 can you share the entire script along with field name selected?
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 03:53 PM
Hi Harish,
The code worked and I'm able to make the option not selected for the user. Could you please let me know if there is a way to show the message to the user other than alert. I tried spmodal, but its not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 04:40 PM
Hi @janindiadoc_1 you can use any clent side API like g_form.addErrorMessage();
Harish