Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

SCENARIO BASED INTERVIEW QUESTIONS

Khan Ejaz
Tera Contributor
/*Req 1:- Write a script to add "Test" in short description before on last 10 updated incident?*/

var grinc = new GlideRecord('incident');
grinc.addQuery('active',true);
grinc.setLimit(10);
grinc.orderByDesc('sys_updated_on');
grinc.query();
while(grinc.next()){
    gs.info("Incident:"+grinc.number+","+grinc.sys_updated_on+","+grinc.short_description);

    grinc.short_description="TEST "+grinc.short_description;
    gs.info(grinc.short_description);
    //grinc.update();
}

/*Req 2-Write a script to modify category= Software and short description= "Test Problem"  on last 10 updated active records problem tickets?*/

var grprm=new GlideRecord('problem');
grprm.addActiveQuery();
grprm.setLimit(10);
grprm.orderByDesc('sys_updated_on');
grprm.query();
while(grprm.next()){
    gs.info(grprm.number+","+grprm.sys_updated_on+","+grprm.short_description+","+grprm.category);
    grprm.category='software'
    grprm.short_description="TEST "+grprm.short_description;
    gs.info(grprm.number+","+grprm.sys_updated_on+","+grprm.short_description+","+grprm.category);
    //grinc.update();
}
0 REPLIES 0