- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 09:21 AM
Hi Team can someone explain to me what is a fix script so i created a business role that change the statut based on a state
and i need to create a fix script to update initially all the records that have that state to the correct statut
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 09:34 AM
Hello @yoli1,
A fix script is a server-side JavaScript code that runs after an application is installed or upgraded. You can use fix scripts to make changes that are necessary for the data integrity or product stability of an application, such as adding, updating, or deleting data, rules, scripts, or property settings.
If you created a business rule that changes the status based on a state, and you want to update all the existing records that have that state to the correct statuses, you can create a fix script that queries the table and updates the status field accordingly. For example, you can use the following code to update the status of all incidents that have the state “New” to “Open”:
var gr = new GlideRecord('incident');
gr.addQuery('state', 'New');
gr.query();
while (gr.next()) {
gr.status = 'Open';
gr.update();
}
You can modify the code to suit your needs and test it before running it on production. For more details on how to create, test, and run fix scripts, see this article or this article. I hope this helps. 😊
Best Regards,
Swarnadeep Nandy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 10:28 AM
This explains.
Option to create Customer Update records [sys_update_xml] when the fix script runs. Fix script tests enforce the Unloadable option. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 11:02 AM
@SwarnadeepNandy When i refresh the table in dev the old value is still there do you know where the problem might be?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:09 PM
- https://macul.medium.com/consertando-o-rumo-por-que-o-fix-script-%C3%A9-a-ferramenta-certa-para-corr...
- KB0761248 How to enable and use rollback functionality for Fix Scripts
- ServiceNow Things to Know 108: Fix Script
- Updating Applications with Fix Scripts.