Background scripts are always run in global scope

Krishna119
Kilo Contributor

Experience of running background scripts is not the same in VS Code vs Instance (Scripts - Background)

While VS Code status bar shows the current scope, Background Script always runs in rhino.global scope, making scoped scripts untestable. For example, I cannot use deleteMultiple on a scoped table, obviously.

Is scope even supported?

8 REPLIES 8

Shasank
ServiceNow Employee
ServiceNow Employee

What is the scope of the application (in VSCode) where you are trying to run ‘Run Background Script - Current’?
I’m guessing it’s global. Hence the scripts are running in rhino.global space.

 

Please let us know if it is not the case.

I'm opening an application and only then I can run a background script. The application name is visible in the status bar on bottom right. That means I'm in the scope of that application, right? Now, whether I use 

  • Run Background Script - Current (OR)
  • Run Background Script - Global 

my script is run only in global scope. 

 

Is there any other way to check the scope?

Shasank
ServiceNow Employee
ServiceNow Employee

In platform, open sys_app.list, and look for the scope against the name of the application.

 

If the scope is non global, can you paste / attach the sample script you are running?

I'm having some trouble authenticating PDI from VSCode. Will get back later.