Making field read only for non admin users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 02:00 AM
Hi,
I want to make two fields read only for some non admin users on workspace form .
How can I achieve this with UI Policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 02:05 AM
Hello @shubhamverm3478 ,
You can use GlideUser API in UI Policy script.
var isadmin = g_user.hasRole('admin', true);
if(isadmin){
// Perform the action
}
Please mark my answer as accepted solution and give thumbs up, if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 02:08 AM
Can you specify application scope will be global or worksapce?
Also view if not global?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 02:12 AM
That will be automatically defined upon selection of the scope in which you are working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 02:12 AM - edited ‎09-12-2024 02:13 AM
Hi @shubhamverm3478,
You can use this in UI Policy script:
if (g_user.hasRole('admin', false)){
g_form.setVisible('ENTER YOUR FIELD 1 NAME', false);
g_form.setVisible('ENTER YOUR FIELD 2 NAME', false);
}
If you found my response helpful, please mark it as Solution and Helpful.
Thanks and Regards,
Ehab