Catalog Request client script not working based on role of submitter

ChrisWing
Mega Guru

I have an offboarding form that was built by our initial implementor.  Within the form they have built two fields for Current Assets the person being offboarded has.  The first is a script that goes into the CMDB and looks up any record that has the "User" in the Assigned_to field.  The second is just a straight multi-line text the is available if the first script doesn't find anything.  

 

The issue I seem to have is that when the form is being opened the onChange script doing the look up does not appear to work if the person does not have sufficient rights (ITIL).  I have checked and the flow is set up as system but given this is part of the catalog design and a script is there a way to make the script run as admin.  Do I need to convert this to a script include?

 

Below is the script being used.

 

ChrisWing_0-1747231924857.png

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Using a GlideRecord in a Client Script is not recommended as a best practice, nor supported.  Use GlideAjax to call a script include https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

or getReference https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc... 

or see if the Variable Auto-Populate feature will work in this case.

https://www.servicenow.com/community/developer-articles/auto-populate-a-variable-based-on-a-referenc... 

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

Using a GlideRecord in a Client Script is not recommended as a best practice, nor supported.  Use GlideAjax to call a script include https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

or getReference https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc... 

or see if the Variable Auto-Populate feature will work in this case.

https://www.servicenow.com/community/developer-articles/auto-populate-a-variable-based-on-a-referenc... 

ChrisWing
Mega Guru

I don't think the auto-populate will work in this context as it is an array.  I was already kind of leaning towards the script include so I will investigate that option further.

ChrisWing
Mega Guru

Thanks for the help Brad, apparently the implementer did a script include actually shows up in the pasted code I had, the issue was the ACL was set to ITIL instead of a lower permissiblity level.  Typically the user submitting the form would be a Business_Stakeholder or User so adjusted the ACL and now working!