- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 07:04 AM
Hello
I am trying to create a background script for closing a change, for which workflow has broken. Advise on it please.
function getUserRegion() {
var u = gs.getnumber();
var gr = new GlideRecord('change_request');
gr.addQuery('CHG00046',u);
gr.query();
while (gr.next()) {
gr.u_stage= 7;
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 05:18 AM
If you need to change the state, then update the script to use the state field instead.
var gr = new GlideRecord('change_request');
if (gr.get('number', 'CHG00046')) {
gr.state= 7;
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 05:18 AM
If you need to change the state, then update the script to use the state field instead.
var gr = new GlideRecord('change_request');
if (gr.get('number', 'CHG00046')) {
gr.state= 7;
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 09:15 AM
Thanks for the perfect code, i found my closed state was 3. The code did other magic's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:57 AM
You are welcome.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 06:46 AM
Hi Hari,
Don't forget to click the "Correct Answer" so we can close out this thread. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 09:01 AM
Its done thanks, for all the help.
