What is the difference between Fixed scripts & background Scripts?

Akshay64
Tera Contributor

What is the difference between Fixed scripts & background Scripts ? can anyone please tell what is the exact difference i read many articles but didn't get those. i am Expecting exact difference.  Thank you in advance.

4 REPLIES 4

John Zhang1
Kilo Patron
Kilo Patron

 

Fix Script - Is specific for data of an application that has been installed/upgraded. Background script-mass creations, updates, and deletions of records.

 

Please more detail in this post-https://community.servicenow.com/community?id=community_question&sys_id=3e427075dbeb5344200f0b55ca961945#:~:text=Fix%20Script%20%2D%20Is%20specific%20for,Also%2C%20used%20for%20troubleshooting.

 

 

If my reply is Helpful/Correct, please mark the answer as correct. This will help others searching for a similar question, and will take the question off the unsolved list.

Community Alums
Not applicable

Hi Akshay,

A fix script is server-side JavaScript code that you run after an application is installed or upgraded.

Include fix scripts to make changes that are necessary for the data integrity or product stability of an application. Administrators can create, manage, and run fix scripts. Users with the script_fix_admin role can create and manage fix scripts but cannot run fix scripts.

Whereas  for Background Script :-

Administrators can use the Scripts - Background module to run arbitrary JavaScript code from the server.

The Scripts - Background module consists of the following components.
  • A text field to enter JavaScript
  • A selector to specify the application scope
  • Run script button
  • A list of available scripts
  • Record for rollback? check box. Selected by default, this creates a rollback context for the script execution. After the script is run, click the Script execution and recovery available here link to go to the Script Execution History form where you can rollback the script.

Administrators can run any valid JavaScript that uses the Glide API. The system displays results, information, and error messages at the top of the screen.

Note: Running free-form JavaScript can cause system disruption or data loss. Do not run free-form scripts from a production instance.
 
Here is a Article Shared by Paul, you can learn more here too : https://community.servicenow.com/community?id=community_blog&sys_id=677f8b23db646810b1b102d5ca9619b4
 
Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Community Alums
Not applicable

Hi Akshay,

Kindly mark the answer as Correct & Helpful both such that others can get help.

Thanks,
Sandeep

Hitoshi Ozawa
Giga Sage
Giga Sage

Following article has a good explanation on Fix Script vs Background script and which to choose.

In a nutshell,

Fix Script:

  1. Can be saved (can use ServiceNow's inline javascript editor)
  2. Can be added to update set
  3. Can run in background
  4. No rollback by default (need to add Record for rollback checkbox)

Background script

  1. Can't be saved (can't use ServiceNow's inline javascript editor)
  2. Is not added to update set
  3. Runs in foreground
  4. Can rollback by default (i.e. Record for rollback is checked)
  5. Has sandbox mode
  6. Script auditing
  7. Reporting of changed records after execution
  8. Readable log output

https://community.servicenow.com/community?id=community_blog&sys_id=677f8b23db646810b1b102d5ca9619b4