
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 12:04 PM
Hey Everyone,
I need to simply update the State of 1 incident record to Closed.
What is wrong with my code?
var incidentGR = GlideRecord('incident');
incidentGR.get('sys_id');
incidentGR.state.setValue('Closed');
incidentGR.update();
What am I doing wrong? It runs, but it isn't updating that specific incident.
Thanks,
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 12:06 PM
Hi,
var incidentGR = GlideRecord('incident');
incidentGR.get('sys_id'); //you need to place actual sys_id of the record here
incidentGR.setValue('state', 7); //whatever the back-end value for Closed is, OOB is 7
incidentGR.update();
For future reference, please refer to GlideRecord documentation for appropriate formatting, etc.: https://developer.servicenow.com/dev.do#!/reference/api/paris/server/no-namespace/c_GlideRecordScope...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 12:06 PM
Hi,
var incidentGR = GlideRecord('incident');
incidentGR.get('sys_id'); //you need to place actual sys_id of the record here
incidentGR.setValue('state', 7); //whatever the back-end value for Closed is, OOB is 7
incidentGR.update();
For future reference, please refer to GlideRecord documentation for appropriate formatting, etc.: https://developer.servicenow.com/dev.do#!/reference/api/paris/server/no-namespace/c_GlideRecordScope...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!