- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 09:54 AM
Hello,
I am on Helsinki Patch 6.
I have a record producer that submits a record to the incident table. I have 3 fields on the record producer, Category, Subcategory, and Subcategory Type, that are all dependent on each other. Subcategory Type should only populate for certain subcategories I have created several catalog client scripts to control this functionality. These client scripts work without issue when testing them on my Admin account, however when I switch over to an ITIL or ESS user, the scripts do not function correctly.
Example:
Admin User | Non-Admin User (ESS) |
---|---|
![]() | ![]() |
I have the following Catalog Client Scripts active:
- Clear Subcategory onLoad
function onLoad (control, oldValue, newValue, isLoading) {
g_form.clearOptions('subcategory');
}
-Category / Subcategory Dependency (onChange)
function onChange(control, oldValue, newValue, isLoading) {
if(newValue == oldValue){
return;
}
//remove all items from subcategory drop down to start
g_form.clearOptions('subcategory');
//build a new list of dependent options
var gp = new GlideRecord('sys_choice');
gp.addQuery('dependent_value', newValue);
gp.addQuery('element', 'subcategory');
gp.addQuery('inactive', 'false');
gp.orderBy('label'); //Order subcategory by the label value
gp.query();
while(gp.next()){
g_form.addOption('subcategory', gp.value, gp.label);
}
}
-Clear Subcategory Type onLoad
function onLoad (control, oldValue, newValue, isLoading) {
g_form.clearOptions('u_subcategory_type');
}
- Subcategory / Subcategory Type Dependancy
function onChange(control, oldValue, newValue, isLoading) {
if(newValue == oldValue){
return;
}
//remove all items from subcategory drop down to start
//g_form.clearOptions('u_subcategory_type');
//build a new list of dependent options
var gp = new GlideRecord('sys_choice');
gp.addQuery('dependent_value', newValue);
gp.addQuery('element', 'u_subcategory_type');
gp.orderBy('label'); //Order subcategory by the label value
gp.query();
while(gp.next()){
g_form.addOption('u_subcategory_type', gp.value, gp.label);
}
}
Everything works 100% correct and as intended on admin role accounts but nothing else and I've been having the toughest time trying to figure out why. Has anyone seen anything like this or can shed some light on where to look to try and resolve it?
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 10:35 AM
Usually when I run into problems like this, it's related to the ACLs on the tables that you're linking to. I would check and make sure that the non-admin user has read access on the fields that are being accessed by the client script. Hopefully granting read access will clear up the issue.
EDIT: I've also found that some judicious use of gr.getRowCount() can be very useful in cases like this to make sure that you're actually getting the number of records (or any records at all) from your GlideRecord queries, without having to try to delve into actual GlideRecord objects that might or might not exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2016 10:15 AM
Thank you Abhinay, this did not resolve the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 12:50 PM
ok the first thing i would do is disable all of the client scripts that are updating them....
now login as an itil user and look at the drop downs... all choices should be there for every one of the fields... if not.. it is an acl problem
if the items are there but the scripts don't work it is something in the client scripts themselves... but first we need to figure out if it is a client issue or an acl issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 12:55 PM
Thank you, Raymond.
I have run through this before and can confirm that disabling the client scripts does in fact display all of the Categories, Subcategories, and Subcategory Type values.
Edit: I have also activated ONLY the "Subcategory / Subcategory" type and dependency script. That script is now working fine with the others turned off. It seems the scripts do not like working together for some reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 01:01 PM
interesting that ONLY subcategory type isn't working for non admins..
can you compare the acl's for subcategory and subcategory type to see if there is a difference.. i have never used this method of building related lists... so am wondering if the user needs a write rule on subcategory type to have the add option work correctly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2016 01:17 PM
Both Subcategory and Subcategory Type (obviously a user created table) have identical ACLs. I have also removed the write restrictions and the scripts still do not work together.
I do not believe it is an ACL issue with these two variables as they work without issue on the actual incident table.