Interview Questions Servicenow
Interview Questions Servicenow
BEFORE INSERT:
current.setAbortAction(true);
})(current, previous);
========================================================================
======
Task2:
Populate assignment group with Service desk and assigned to as ITIL user
BEFORE INSERT:
current.assignment_group = "d625dccec0a8016700a222a0f7900d06";
current.assigned_to = "681b365ec0a80164000fb0b05854a0cd";
})(current, previous);
========================================================================
======
Task3:
BEFORE UPDATE:
current.addQuery('category', 'software');
current.query();
current.contact_type = "phone";
current.update();
})(current, previous)
========================================================================
======
Task4: if the user is having Admin role show only priority 1,ctageory-harware,state - new tickets.
BEFORE QUERY:
if (gs.hasRole('admin')) {
current.addQuery('priority', '1');
current.addQuery('category', 'hardware');
current.addQuery('state', '1');
})(current, previous);
========================================================================
======
Task5:
Show caller email id, company, mobile number and manager when form loads.
DISPLAY:BR
g_scratchpad.caller = current.caller_id.email.getDisplayValue();
g_scratchpad.company = current.caller_id.company.getDisplayValue();
g_scratchpad.manager = current.caller_id.manager.getDisplayValue();
g_scratchpad.mobilephone = current.caller_id.mobile_phone.getDisplayValue();
})(current, previous);
CLIENT SCRIPT:
var inc =
[g_scratchpad.caller,g_scratchpad.company,g_scratchpad.manager,g_scratchpad.mobilephone]
alert(inc);
}
gs.addInfoMessage('Caller email '+ current.caller_id.email);
========================================================================
======
Task6:
BEFORE INSERT
agg.addAggregate('COUNT', 'caller_id');
agg.query();
while (agg.next()) {
})(current, previous);
========================================================================
======
Task 7:
INCIDENT
AFTER INSERT:
prb.initialize();
prb.first_reported_by_task = current.sys_id;
prb.insert();
current.problem_id = newprb;
current.update();
})(current, previous);
Task 8:
Attach a child incident to any incident, when the parent incident short description
AFTER INSERT:
Prob.addQuery(‘problem_id’,current.sys_id);
Inc.query();
While (inc.next()) {
Inc.short_description = current.short_description;
Inc.update();
})(current, previous);
Task 9:
Update the associated change request assignment group with the problem record assignment
AFTER UPDATE:
Change_request record
Chng.query();
While (chng.next()) {
Chng.short_description = current.short_description;
Chng.update();
})(current, previous);
========================================================================
======
Task 10:
AFTER UPDATE:
inc.addQuery('problem_id',current.sys_id);
inc.query();
while(inc.next()){
inc.state = "7";
inc.close_code = "Solved(Permanently)";
inc.update();
})(current, previous);
========================================================================
======
Task 11:
Create change task on change record , when change record is closed the related change task
AFTER INSERT
AFTER UPDATE
chng.addQuery('change_request', current.sys_id);
chng.query();
while (chng.next()) {
chng.state = current.state;
chng.update();
})(current, previous);
========================================================================
======
Task 12:
Create a business rule on "Info" such that whenever the records are inserted or updated in it, it
AFTER INSERT:
gr.initialize();
gr.u_refinfo = current.sys_id;
gr.u_backup_description = current.u_description;
gr.insert();
})(current, previous);
AFTER UPDATE:
gr.addQuery("u_refinfo", current.sys_id);
gr.query();
if (gr.next()) {
gr.u_backup_description = current.u_description;
gr.update();
})(current, previous);
========================================================================
======
Task 13:
Use that scratch pad in the onload script and perform some manipulation like hiding some fields.
G_scratchpad.caller = current.caller_id.getDisplayValue();
})(current, previous);