The CreatorCon Call for Content is officially open! Get started here.

Background script to query the value of a field

sigmachiuta
Kilo Guru

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();

}

1 ACCEPTED SOLUTION

Refresh the page, I believe security admin rights have been expired . Elevate your privileges again and open the background script and try now.


View solution in original post

5 REPLIES 5

akashsrm100
Kilo Guru

HI


I believe that you skip


gr.query();



Thanks


Akash Sharma


PS Hit like correct of helps