Unable to access a global script include from an advanced qualifier of a scoped app

Mussie
ServiceNow Employee
ServiceNow Employee

Hi Guys,

I am using the below referenced qualifier from a scoped app (x_univ6_as_00002) form which is extended from task.

javascript: 'sys_idIN' + (new SNCBusinessServiceUtils()).getServicesForCompany(current.company, 'u_high_level_business_service', '', '', 'advancement');

And this isn't giving me the results I am after, probably because SNCBusinessServiceUtils() is a global script include. And when I changed this to:

javascript: 'sys_idIN' + (new global.SNCBusinessServiceUtils()).getServicesForCompany(current.company, 'u_high_level_business_service', '', '', 'advancement');

It is not working either and am getting the following error:

Illegal access to private script include SNCBusinessServiceUtils in scope rhino.global being called from scope x_univ6_as_00002

Any idea why?

Mussie

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Mussie,



Can you navigate to the script include "SNCBusinessServiceUtils" and make sure that the accessible from is set to all application scope.


View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Mussie,



Can you navigate to the script include "SNCBusinessServiceUtils" and make sure that the accessible from is set to all application scope.


The SN Nerd
Giga Sage
Giga Sage

What you are seeing is expected behavior - globally scoped scripts with 'Accessible' from this scope only' cannot be called from Scoped Applications.



You need to write your own functionality to mimic that script.



  • If you plan on publishing your app, you won't be able to include the scope access change to that script.
    • Changes to globally scoped items will not be included in your Update Set.
    • It will not be certified.

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Mussie
ServiceNow Employee
ServiceNow Employee

That did the trick Pradeep, thank you for your help. Also thanks Paul for the details.