Background Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2023 09:46 PM
Background Scripts are Server side scripts that can be immediately run on ServiceNow instance and can be very helpful if you want to try scripts out or fix minor issues on records.
To write a Background Script Go to Application Navigator > Scripts - Background. A window will be opened to write your script into.
There are a few options/checkboxes at the bottom of the window that function pretty much as their name would suggest :
- Run script: This a button that Runs the script in the Run script window on the server side.
- in scope: This is a drop down that allows you to run the script in different scope outside of global if required.
- Record for rollback?: This checkbox if checked allows you to rollback the results of executed script. This is checked by default. This can be done from Rollback and Recovery > Script Execution History. Then Script Execution History is available for 7 days.
- Execute in sandbox: This is a checkbox that allows script to run with sandbox like restrictions. If checked, data cannot be inserted, updated or deleted.
- Execute as scriplet? : This is a checkbox which if selected allows the script to execute as a scriplet which means it will have access to the global scope and any server side functionality or objects. If the checkbox is not selected the script will be executed in global scope but will not have access to any server side functionality or objects.
- Cancel after 4 hours: This is a checkbox which cancels the script execution if it continues running after 4 hours. This checkbox is checked by default.
If you cannot see the background script option, it means you would need additional privileges to access background scripts. In this case you would need 'security_admin' role. This is managed via a system property that allows only users with elevated privileges to access background scripts.
Regards,
Badal Khojare
Community Rising Star 2023
- 19,900 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2023 09:51 PM
Hello @Badal Khojare ,
You explained the Background script very nicely.
One suggestion.
You can create this as an article.
Please mark the answer as helpful and correct.
Best Regards,
Rajat Choudhary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 10:53 PM
Hi Rajat,
Thankyou. Yes, I was looking to create it as an article and thought I had created it as an article, but I did not 🙂 I will check back again and post it as an article.
Regards,
Badal Khojare
Community Rising Star 2023