Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

ACL rights needed for client script or some other issue?

leonard_gilbert
Tera Expert

Using an old record producer from my company's initial rollout of ServiceNow. I copied the object and am in the process of updating design and options.   My issue is with two client scripts that I updated to get to work on the service portal, well at least partially.   It does not work correctly in Service Portal for non-admin accounts but the catalog view works correctly. In the Service Portal for non-admins, only the 1st option is generated but it is missing the rest.   As noted, my boss and I can see the options correctly in the service portal since we have admin rights. Nothing that I see in the script should have an issue since the catalog version works fine for non-admin accounts but then again I am a novice admin with only hands-on experience for the past 6 months in my company.   Any help would be greatly appreciated.

Populates Subcategories

// This block of code modifies 'subcategory'.

function onLoad(){

// Remove all items from category drop down to start

// Used the g_form.clearOptions() function instead of g_form.removeOption() function

g_form.clearOptions('subcategory');

g_form.addOption('subcategory', '', '-- None --',0);

var gp = new GlideRecord('sys_choice');

gp.addQuery('name', 'incident');

gp.addQuery('dependent_value', "JCIA");

gp.addQuery('element', 'u_app_subcategory');

gp.addQuery('hint', "jcia");

gp.query(function(gp) {

while (gp.next())

g_form.addOption('subcategory', gp.value, gp.label);

});

}

Orders Categories by Sequence

function onChange(control, oldValue, newValue, isLoading) {      

  if(newValue == oldValue){      

  return;      

  }

    //Type appropriate comment here, and begin script below

   

var ch = new GlideRecord('sys_choice');

ch.addQuery('name', 'incident');

ch.addQuery('dependent_value', "JCIA");

ch.addQuery('element', 'u_app_subcategory');

ch.addQuery('hint', "jcia");

ch.orderBy('sequence');

ch.query(function(ch) {

while(ch.next())

g_form.addOption('subcategory', ch.value, ch.label);

});

}

So far I get the same issue when I deactivate Orders Categories by Sequence so I'm thinking that possibly an ACL right is missing that a standard user needs to use this on the portal.   User Portals were not designed yet when ServiceNow was initially brought to my company 6 years ago Since I have only worked here for a year and a half, I see that most things were not kept up to date since no one before me had the role as a ServiceNow Admin. I've also attached some pictures showing the issue.

1 ACCEPTED SOLUTION

dhasselquist
Mega Guru

Leonard,



Before I would attempt to do so via scripting, I would first try to use the native platform features to accomplish your goal. Have you tried creating a Lookup Select Box type variable, and putting your requirements in the "Type Specifications" tab?



As a quick proof of concept, I made a field that will have the same values as the out of the box incident category field.


categoryField.PNG



Edit: After making this post I was able to reproduce the behavior you were experiencing. Using the catalog client script to populate values would not work when viewing the Service Portal as a non-ITIL user. Using the above method however, the field was populating correctly.


View solution in original post

3 REPLIES 3

dhasselquist
Mega Guru

Leonard,



Before I would attempt to do so via scripting, I would first try to use the native platform features to accomplish your goal. Have you tried creating a Lookup Select Box type variable, and putting your requirements in the "Type Specifications" tab?



As a quick proof of concept, I made a field that will have the same values as the out of the box incident category field.


categoryField.PNG



Edit: After making this post I was able to reproduce the behavior you were experiencing. Using the catalog client script to populate values would not work when viewing the Service Portal as a non-ITIL user. Using the above method however, the field was populating correctly.


Honestly, I was too caught up with trying to get the old form to work because of how someone brought it to my attention that I wasn't thinking that a better option would be just to recreate... Thanks for the observation.



EDIT: Working correctly with non-itil accounts and the Lookup Select Box with my qualifiers.


Leonard,



Glad to help!