- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:36 AM
I am trying to run a BG script that should tell the sc_task records are in the state of 7 and updting them to a new value. 7 being the 'value' of the field. When I run the query nothing is printed out. I have verified there is in fact a record with that state but receive nothing in the window after i run the script. There is also nothing in the log that would indicate an error.
var gr = new GlideRecord('sc_task')
gr.addQuery('state',7);
while (gr.next()){
gs.print('Number updated= '+ gr.number)
gr.state = 2;
gr.update();
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:58 AM
Refresh the page, I believe security admin rights have been expired . Elevate your privileges again and open the background script and try now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:39 AM
You are missing gr.query(). After gr.addQuery(....); add gr.query();
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:51 AM
wow thanks I knew it was a stupid mistake somewhere
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:56 AM
that is unusual after i added that i dont receive anything in the next window its just blank
var gr = new GlideRecord('sc_task')
gr.addQuery('state',7);
gr.query();
while (gr.next()){
gs.print('Number is '+ gr.number)
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 07:58 AM
Refresh the page, I believe security admin rights have been expired . Elevate your privileges again and open the background script and try now.