Visual Studio Code: Cannot run background script (command not available)

Sebastian R_
Kilo Sage

I have setup one of my custom appplications in VS and wanted to run a fix script as background script but the command is not showing up for me.

Can anyone help me with it?

find_real_file.png

1 ACCEPTED SOLUTION

Shiva22
ServiceNow Employee
ServiceNow Employee

The "background script" feature can be found in the contextual menu, when you do a right-click after you select a particular piece of code you want to execute in a Javascript file. Only the lines of code selected (or) highlighted will be executed.

You have the option to run the selected code in the 'Current' scope or the 'Global' scope. 

The results are returned right back to the editor. 

find_real_file.png

View solution in original post

5 REPLIES 5

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

from your printscreen, it seems you didn't type the entire text "Now: Run Background Scripts (Browser)", could you do that and show the result? I tried in my personal VS Code extension (NOW version New York), everything works as described below:

https://developer.servicenow.com/app.do#!/document/content/app_store_doc_vscode_newyork_vscode-backg...

If I have answered your question, please mark my response as correct and/or helpful so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Shiva22
ServiceNow Employee
ServiceNow Employee

The "background script" feature can be found in the contextual menu, when you do a right-click after you select a particular piece of code you want to execute in a Javascript file. Only the lines of code selected (or) highlighted will be executed.

You have the option to run the selected code in the 'Current' scope or the 'Global' scope. 

The results are returned right back to the editor. 

find_real_file.png

I am able to run the background script but results aren't returned back to the editor. 😞

 

Shasank
ServiceNow Employee
ServiceNow Employee

Is the Background script output tab itself not opened? Something like below

find_real_file.png

 

Are you able to see the results when you run the same script from platform’s Background script runner?