Making field read only for non admin users.
Options
- 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.
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 03:13 AM
Is there a way we can add those users sys id rather than role for UI policy script?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 04:04 AM
Make use of below code in that case :
var userSysIDs = ['71826bf03710200044e0bfc8bcbe5d3b', '62826bf03710200044e0bfc8bcbe5df1', 'a8f98bb0eb32010045e1a5115206fe3a']; // Declare an array to store your non-admin user sys_id
var loggedinUserID = gs.getUserID(); //get current logged in user sys_id
if (userSysIDs.indexOf(loggedinUserID) != '-1') //Check if logged in user is part of the non-admin users array or not
{
gs.print('exists'); // Modify here to perform tasks
} else {
gs.print('not exists'); // Modify here to perform tasks
}
Please mark this response as correct and helpful if it assisted you with your question.