Need to check user group "Role" in UI Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-03-2023 06:32 AM
By using UI policy , i'm going to find the user 'group role . if the group role is itil_admin , will make the field editable for the particular user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-07-2023 08:14 AM
Hi Vipul Gupta,
I did exactly what you mentioned early, but it's not working for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-07-2023 10:24 PM
probably because there is a UI policy that comes OOB which is contradicting to this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-08-2023 04:45 AM
GlideSystem (gs) is a server-side API. You cannot use it in a UI Policy because UI Policy scripts are client-side. Use the client-side GlideUser API instead:
g_user.hasRole('admin')
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-08-2023 06:14 AM
its not working. changed the script to g_user.hasrole('itil_admin').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-08-2023 09:16 PM
Hi Vipul Gupta,
I have sheared my UI policy code for reference; please look at it. This code is not working for me.
function onCondition() {
var isAdmin = g_user.hasRole('itil_admin' || 'admin');
if (isAdmin) {
g_form.setReadOnly('short_description', false); // Title
g_form.setReadOnly('caller_id', false); // Client Name
g_form.setReadOnly('contact_type', false); // Channel
g_form.setReadOnly('category', false); // Category
g_form.setReadOnly('subcategory', false); // Subcategory
g_form.setReadOnly('cmdb_ci', false); // Configuration Item
g_form.setReadOnly('u_support_team', false); // Support team
g_form.setReadOnly('assignment_group', false); // Assignment Group
g_form.setReadOnly('assigned_to', false); // Assigned to
g_form.setReadOnly('activity_due', false); // Activity due
g_form.setReadOnly('close_code', false); // Close Code
}
}
