- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 10:09 AM
Hi,
I am trying to figure out how to hide a Question Choice on a Select Box type variable on a catalog item form based on whether the logged in user belongs to a specific group.
I created a Business Rule and a Catalog Client Script but it is not working.
I am unsure what I am doing wrong. The goal for this is that when a user views this form, if the logged in user does not belong to this specific group then certain options in the dropdown will not be visible to them.
Any assistance would be greatly appreciated.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 01:30 PM
You cannot do it by using display business rule for catalog items. You need to do it by GlideAjax
Here is are scripts for script include and client scripts
Script Include
var AjaxGroupMember = Class.create();
AjaxGroupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isMemeber: function(){
return gs.getUser().isMemberOf('Managers');
},
type: 'AjaxGroupMember'
});
Client script
function onLoad() {
//Type appropriate comment here, and begin script below
var cat = new GlideAjax('AjaxGroupMember');
cat.addParam('sysparm_name','isMemeber');
cat.getXML(isMemofGrp);
function isMemofGrp(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'true'){
g_form.removeOption('st_requestchoice', 'Wholesale');
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 01:30 PM
You cannot do it by using display business rule for catalog items. You need to do it by GlideAjax
Here is are scripts for script include and client scripts
Script Include
var AjaxGroupMember = Class.create();
AjaxGroupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isMemeber: function(){
return gs.getUser().isMemberOf('Managers');
},
type: 'AjaxGroupMember'
});
Client script
function onLoad() {
//Type appropriate comment here, and begin script below
var cat = new GlideAjax('AjaxGroupMember');
cat.addParam('sysparm_name','isMemeber');
cat.getXML(isMemofGrp);
function isMemofGrp(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'true'){
g_form.removeOption('st_requestchoice', 'Wholesale');
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 09:53 AM
This worked perfectly. Thank you!