Scheduled Job

yoli1
Tera Contributor

Hello team how can i create a Scheduled job script on the table Incident with filter : active is true and approval is not requested and location is empty 

to Set country to location.country

 

11 REPLIES 11

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
Schedule job is independent of any table.
You can execute the script of your choice within the schedule job.

 

 


Thanks and Regards,

Saurabh Gupta

@Saurabh Gupta  is my Scheduled Scrip correct ?

 

(function () {
    var gr = new GlideRecord('incident');
    gr.addQuery('approvam', '!=', 'requested');
gr.addQuery('location', '');
    gr.query();

    while (gr.next()) {
        gr.location = location.country;
        gr.update();
    }
})();

 

Community Alums
Not applicable

Hi,

try the below script 

   var gr = new GlideRecord('incident');
    gr.addEncodedQuery('active=true^approval!=requested^locationISEMPTY');
    gr.query();
    while (gr.next()) {
        gr.location = location.country;
        gr.update();
    }

Thanks,

Vikas

@Community Alums i want 

gr.region = location.country;

but i have an error : location not defined should i do

gr.region = gr.location.country;

?