- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 12:06 AM
I want change record number using background script how can i do it ?
I used this script help me to find solution.I tried with this code but its inserting new record.
var gr = new GlideRecord ('incident_task');
gr.addQuery('sys_id','cc79b1aa2fa23010466e70682799b6f6');
gr.query();
gr.number= "TASK0020745");
gr.setWorkflow(false);
gr.update();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 12:23 AM
Value is now corrected. This is the right code
var gr = new GlideRecord ('incident_task');
gr.get('cc79b1aa2fa23010466e70682799b6f6');
gr.setValue('number','TASK0020745');
gr.setWorkflow(false);
gr.update();
Please Mark Correct AND Helpful. Thanks
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 12:15 AM
I wouldn't advice you to do so, but if you still want, try the following
var gr = new GlideRecord ('incident_task');
gr.get('cc79b1aa2fa23010466e70682799b6f6');
gr.setValue('number','TASK0020745');
gr.setWorkflow(false);
gr.update();
Please Mark Correct AND Helpful. Thanks!
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 12:18 AM
Have a typo. 🙂
var gr = new GlideRecord ('incident_task');
gr.get('cc79b1aa2fa23010466e70682799b6f6');
gr.setValue('number',TASK0020745');
gr.setWorkflow(false);
gr.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 12:23 AM
Value is now corrected. This is the right code
var gr = new GlideRecord ('incident_task');
gr.get('cc79b1aa2fa23010466e70682799b6f6');
gr.setValue('number','TASK0020745');
gr.setWorkflow(false);
gr.update();
Please Mark Correct AND Helpful. Thanks
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024