Skip to main content

ServiceNow Interview Questions - real time

Let's see some ServiceNow Scenario based Interview Questions & Answers here,

1.> How to fetch latest 10 incident records ?

var grIncident = new GlideRecord('incident'); 

gr.orderByDesc('sys_created_on'); 

gr.setLimit(10); 

gr.query(); 

while (gr.next()) {

 gs.print('check the :'+ grIncident.number);   }

2.>How can you populate caller_id in short Description on Problem form?

Write Onchange client script on Problem table on change of caller Id field 

var caller =g_form.getValue(‘caller_id’); 

g_form.setValue(‘short_description’, caller);

3.>How to send notification to the user who is member of assigned group?

You can write the below code in Advanced condition of Notification gs.getUser().isMemberOf(current.assignment_group);

4.> How can you populate the only users whose department is “Finance” in caller field on Incident form.

Use Simple Reference Qualifier & select “department is “Finance”. You can write the code in Script Include & call it in Advanced Reference Qualifier Syntax – JavaScript : new ScriptIncludeName.function_name();

5.>How to check if User has 'knowledge_owner' role & send notification only to those Users ?

var user =[ ]; 

var usrRole = new GlideRecord('sys_user_has_role'); 

usrRole.addQuery('role.name', 'knowledge_owner'); 

usrRole.query(); 

while(usrRole.next())  { 

user.push(usrRole.user.email.toString());     

}  recepient = user.join();

6.>How to extract a list of members from requested group ?

var groupM = [ ]; 

var grmember = new GlideRecord('sys_user_grmember'); 

grmember.addQuery('group', grpName); 

grmember.query(); 

while(grmember.next()){ 

groupM.push(grmember.user.toString());   }

7>You have hide the “state” field using client Script & written UI Policy to show the state field on Incident form. What will happen?

State field will be shown on Incident form In case of any conflict b/w UI Policy & Client Script, UI Policy will be applicable.

8.>How to convert Json object into String?

JSON.stringify(jsonObj);

9.>How to set Contact number of requested user(which is reference field & refer to sys_user table)?

var caller = g_form.getReference(‘requested_user', setContactNumber); 

function setContactNumber(caller) { 

g_form.setValue('u_contact_number', caller.phone);   }

10.>How to create new change request type in ServiceNow?

Using edit Interceptor

11.>How to enable or disable an application in ServiceNow?

Following steps will help you do the same: Navigate to “Application Menus” module Open the respective application. Set value for active as ‘true’ to enable it or set it to ‘false’ to disable it.

12.> How to trigger CAB approval for a change request without using Workflow?

Using Change Approval  Policy

13.>How to count the incident open for any specific caller ?

var gr= new GlideRecord('incident'); 

gr.addQuery('caller_id', ‘ABC_caller’); 

gr.addInfoMessage(gr.getRowCount()); 

gr.query(); 

while(gr.next()) { 

gs.addInfoMessage(gr.number);   }

14.>When logged in user changes the priority of an existing incident record then email notification should be sent to the caller ?

Event registry – Create Event Write Business Rule to trigger the event when priority changes (Using gs.eventQueue(‘event_name’, GlideRecord object, Parm1, Parm2); 

Configure Email notification

15.>How to create an incident though an email ?

Email Inbound action – 

current.caller_id = email.to; 

current.comments = "received from: " + email.origemail + "\n\n" + email.body_text; current.short_description = email.subject; 

current.description = email.body_text; current.insert();  

Refer whole set of ServiceNow Scenario based Interview Q& A on YouTube. video Link : ServiceNow Interview Q&A


Comments

Popular posts from this blog

Difference b/w After & Async Business Rule in ServiceNow

Let's try to understand difference b/w  After & Async Business Rule & some examples on Real time scenario of After Business Rule & Async Business Rule : 1.> After BR executes synchronously (It will wait for a result, once result is ready & get displayed then user will get control to do anything, user has to wait) but Async BR executes asynchronously (user will get control immediately, it will not halt the user and result will get displayed when its ready or get response from system, it will be executing in the background as per system scheduler). 2.>After BR is used to update information on related objects that need to be displayed immediately such as GlideRecord queries etc. whereas Async BR is used to update the information on related objects that do not need to be displayed immediately such as calculating metrics & SLA etc. 3.>We can use current & previous objects but We can’t use previous object in Async rule & current ob...

Access Control List (ACL) in ServiceNow

First, Let's understand what is Access Control List (ACL) in ServiceNow? Access Control Lists are the process by which ServiceNow provides granular security for its data and can be applied to individual records, as well as fields within those records. Rules for access control lists (ACLs) restrict access to data by requiring users to pass a set of requirements before they can interact with it.  All access control list rules specify:  1.> The object and operation being secured  2.>The permissions required to access the object There are some important ACL record operation types  - create : Enables users to insert new records (rows) into a table. read : Enables users to display records from a table. write : Enables users to update records in a table. delete : Enables users to remove records from a table or drop a table. edit_task_relations : Enables users to extend the Task [task] table. edit_ci_relations : Enables users to extend the Configura...