How to write a script for variable (request for) editable for only specific group (DELL).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2025 02:25 AM
When Im requesting new task request_for variable need to editable for only DELL support group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2025 06:35 AM
Hi @Ambati ,
Write a Onload Script on the catalog/ request form that calls a script include and inside the script include, verify the user is part of the group by using. gs.getUser().isMemberOf("Groupname or sysid here"); and return the value.
Thanks,
Yaswanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2025 07:00 AM
you can use onLoad catalog client script + GlideAjax
-> Catalog client script (Applies on Catalog Task view = True)
-> Script include checks user membership
Script Include: it should be client callable
var CheckMembership = Class.create();
CheckMembership.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserInDellSupportGroup: function() {
var dellSupportGroupSysId = 'dell_support_group_sys_id'; // Replace with actual DELL Support group sys_id
return gs.getUser().isMemberOf(dellSupportGroupSysId);
},
type: 'CheckMembership'
});
onLoad catalog client script
function onLoad() {
var ga = new GlideAjax('CheckMembership');
ga.addParam('sysparm_name', 'isUserInDellSupportGroup');
ga.getXMLAnswer(function(response) {
if (response.toString() === 'true') {
g_form.setReadOnly('request_for', true);
} else {
g_form.setReadOnly('request_for', false);
}
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2025 03:06 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2025 03:40 AM
Hi @Ambati
You can achieve this using an onLoad Catalog Client Script in combination with a GlideAjax Script Include.
Steps:
-
Catalog Client Script
-
Applies on: Catalog Task view = True
-
Purpose: Calls the Script Include to check if the user is in the Dell Support group.
-
-
Script Include
-
Must be Client Callable.
-
Verifies whether the current user belongs to the Dell Support group.
-
Script Include
var CheckMembership = Class.create();
CheckMembership.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserInDellSupportGroup: function() {
var dellSupportGroupSysId = 'dell_support_group_sys_id'; // Replace with actual DELL Support group sys_id
return gs.getUser().isMemberOf(dellSupportGroupSysId);
},
type: 'CheckMembership'
});
onLoad Catalog Client Script
function onLoad() {
var ga = new GlideAjax('CheckMembership');
ga.addParam('sysparm_name', 'isUserInDellSupportGroup');
ga.getXMLAnswer(function(response) {
if (response.toString() === 'true') {
g_form.setReadOnly('request_for', true);
} else {
g_form.setReadOnly('request_for', false);
}
});
}