Servicenow interview Questions : Part 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Beginner Level Interview Questions 📜
3)Can we add permissions to the users and groups? which is the best practice?
Answer)Yes , we can add roles to the users and groups manually and as well as with the script by using GlideRecord. the best practice is to add the permissions
from group...so that whenever an employee leaves an organisation and if we remove that person from the group the roles will be removed automatically.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
4)What is the user table name?
Answer)sys_user
-----------------------------------------------------------------------------------------------------------------------------------------------------------
5)What is the group member table name?
Answer)sys_user_grmember
-----------------------------------------------------------------------------------------------------------------------------------------------------------
6)How to create user account using script?
Answer)By using glide record as follows
var userGr = new GlideRecord('sys_user');
userGr.initialize();
userGr.user_name='jdoe';
userGr.first_name='John';
userGr.last_Name = 'Doe';
userGr.email = 'jdoe@example.com';
userGr.insert();
------------------------------------------------------------------------------------------------------------------------------------------------------------
7)How to create group using script?
Answer)By using GlideRecord as follows
var newGr = new GlideRecord('sys_user_group');
newGr.initialize();
newGr.name='testing';
newGr.manager='62826bf03710200044e0bfc8bcbe5df1';
newGr.email='testing@tcs.com';
newGr.description='test';
newGr.insert();
------------------------------------------------------------------------------------------------------------------------------------------------------------
8)How to add permissions to user/group account using script?
Answer)When ever a permission is added to a user account a record in sys_user_has_role table will get created, we can add a role to a user by using script as
follows
var userRole=new GlideRecord('sys_user_has_role');
userRole.setValue('user','62826bf03710200044e0bfc8bcbe5df1');
userRole.setValue('role','2831a114c611228501d4ea6c309d626d');
userRole.insert();
--->Now for group:When we add a permission a group ,a record will be created inside sys_group_has_role table, we can add a role to a group by using script as
follows
var grpRole=new GlideRecord('sys_group_has_role');
grpRole.setValue('group','477a05d153013010b846ddeeff7b1225');
grpRole.setValue('role','2831a114c611228501d4ea6c309d626d');
grpRole.insert();
------------------------------------------------------------------------------------------------------------------------------------------------------------
9)What exactly user delegation means in ServiceNow?
Answer)User delegation means allowing a user to work on behalf of another user within an organization. This is generally used when the original user/employee is
unavailable, such as when they are on vacation or leave. The delegated user gets the permissions to perform tasks and he can also get access to the resources
which are normally available to the original user.
For example, in an office, if an employee is going on vacation, they can delegate their approval tasks to a colleague. This way, important tasks and workflows
continue smoothly without interruption.
for this you need to go to ->original user account->scrolldown->click delegates-> here you can provide the details such as delate(name of the person ou want to
delegate your work),start date, end date and you can also give the permissions for assignments, notifications , approvals.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
10)How to and and remove group member from group using script?
Adding Group Member:
var grMem=new GlideRecord(sys_user_grmember);
grMem.user='62826bf03710200044e0bfc8bcbe5df1';
grMem.group='477a05d153013010b846ddeeff7b1225';
grMem.insert();
Removing Group Member:
var grMem=new GlideRecord(sys_user_grmember);
grMem.addQuery('user','62826bf03710200044e0bfc8bcbe5df1');
grMem.addQuery('group','477a05d153013010b846ddeeff7b1225');
grMem.query();
if(grMem.next()){
grMem.deleteRecord();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------
11)How many user interfaces are there in snow?
Answer)UI15,16 next experience
------------------------------------------------------------------------------------------------------------------------------------------------------------
12)What is mean by web services user in the User account?
Ans)when a web services access is grant only to a 3rd party application to get connected to the ServiceNow then it is called as web services user and moreover this
user can not login as a snow user into servicenow .
------------------------------------------------------------------------------------------------------------------------------------------------------------
13)How to get the current logged in user system id in the client side?
Answer)g_user.UserID;
//6816f79cc0a8016401c5a33be04be441
------------------------------------------------------------------------------------------------------------------------------------------------------------
14)How to get the current logged in user system id in the server side?
Answer)gs.getUserID();
------------------------------------------------------------------------------------------------------------------------------------------------------------
15)How to check if the current logged user is the member of particular group or not?
Annswer)gs.getUser().isMemberOf('group name'); //true if part of the specified group
//false if not part of specified group
------------------------------------------------------------------------------------------------------------------------------------------------------------
16)Which role is required to work on access control?
Answer)Security_admin
------------------------------------------------------------------------------------------------------------------------------------------------------------
17)What is impersonation?
Answer) logging in as another user for testing.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
18)What is user preference?
users can change their preferences based on their wish, so when user change their preferences it will only impact to the same user it will not impact globally
------------------------------------------------------------------------------------------------------------------------------------------------------------
19)What is incident?
Sudden interruption in the service when the employee works in the organization if something suddenly stopped working he will get the support from support
engineer by creating a incident.
------------------------------------------------------------------------------------------------------------------------------------------------------------
20)What is problem?
Answer)if the same issue is repeatedly happening to the same employee then it is called problem. if the same problem is happening to the multiple people at the
same time then its an incident, where will create a parent incident and rest of all will be child incidents, whenever you close the parent incident the child incidents
will be also get closed
----------------------------------------------------------------------------------------------------------------------------------------------------
21)Can we create problem record from incident?
Answer)yes, if the issue is repeatedly occurring then we will create a problem from incident.
------------------------------------------------------------------------------------------------------------------------------------------------------------
22)Can We create a change request from incident?
Yes, when ever you create an incident if the support engineer feels that their should be some change in the software then he will arise a change request from that
incident.
------------------------------------------------------------------------------------------------------------------------------------------------------------
23)How to create incident record using script?
Answer)Using GlideRecord as follows
var gr = new GlideRecord('incident');
gr.initialize();
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94';
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3';
gr.short_description = 'test record using script';
gr.description = 'test record using script';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018';
gr.insert();
-----------------------------------------------------------------------------------------------------------------------------------------------------------
24)How to create problem record using script?
Answer)Using GlideRecord as follows
var gr = new GlideRecord('problem');
gr.initialize();
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94';
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3';
gr.short_description = 'test record using script';
gr.description = 'test record using script';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018';
gr.insert();
-----------------------------------------------------------------------------------------------------------------------------------------------------------.
25)How to create change request using script?
Answer)Using GlideRecord as follows
var gr = new GlideRecord('change_request');
gr.initialize();
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3';
gr.short_description = 'test record using script';
gr.description = 'test record using script';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018';
gr.insert();
-----------------------------------------------------------------------------------------------------------------------------------------------------------
26)Write a logic for whenever a parent incident is get closed all the child incidents should also get closed.?
Answer: Write a after business Rule
When -- After
Update - true
Condition: current.state.changesTo(7);
if (current.state == 7 && current.parent == '') {
// GlideRecord to find child incidents
var grChild = new GlideRecord('incident');
grChild.addQuery('parent', current.sys_id);
grChild.query();
while (grChild.next()) {
grChild.state = 7; // Set the state to Closed
grChild.update(); // Update the child incident
}
}
27)There is an incident and that incident has associated 2 tasks ,when u try to close that incident if any incident task is open so employee should not close the
incident. Similarly for problem, and change request.?
Answer:
var grTask = new GlideRecord('incident_task');
grTask.addQuery('incident', current.sys_id);
grTask.addQuery('state', '!=', 3); // Assuming 3 is the state value for 'Closed'
grTask.query();
if (grTask.hasNext()) {
gs.addErrorMessage('Cannot close the incident because there are open tasks.');
current.setAbortAction(true);
}
28)Whenever problem is closed the associated incident will also get closed.?
Answer:
if (current.state == 7) {
// GlideRecord to find incidents associated with the problem
var grIncident = new GlideRecord('incident');
grIncident.addQuery('problem_id', current.sys_id);
grIncident.addQuery('state', '!=', 7); // Assuming 7 is the state value for 'Closed'
grIncident.query();
while (grIncident.next()) {
grIncident.state = 7; // Set the state to Closed
grIncident.update(); // Update the incident
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------
29)What is the relationship between incident , problem and change management?
Answer:
if a person face some issue he will create an incident and if the same issue is happening again and again then he will create a problem , and if the support team feels
like some changes are required in their software then they will create a change request.
------------------------------------------------------------------------------------------------------------------------------------------------------------
30)Give me some names of out of the box tables?
Answer)the tables which doesn't starts with x_ or u_ those tables we called as out of the box, incident, x_ means id the table is create in scoped application.
------------------------------------------------------------------------------------------------------------------------------------------------------------
31)What are some of the base tables?
Answer)task ,cmdb_ci table the tables which don't extend any table but extended by many tables.
------------------------------------------------------------------------------------------------------------------------------------------------------------
32) give me some examples of tasks tables?
Answer:
incident, problem change request which are extending task table.
------------------------------------------------------------------------------------------------------------------------------------------------------------
33)whenever we create a table how many access controls will get created?
Answer: 4 ACL when creating a table by default 4 AC will be created because of the check box is checked if you uncheck it will not create ACL.
------------------------------------------------------------------------------------------------------------------------------------------------------------
34)How to create number field, like incident number?
Answer)You have to go to the control tab and u have to provide the prefix and no of digits we have to check the auto number field when creating incident table.
------------------------------------------------------------------------------------------------------------------------------------------------------------
35) what happens when you extend a table?
Answer) when u extend a table the sys fields will not get created in child table bcz those are coming from parent table and a field called class will be created in
parent table and if a table is extending many tables it will have only one class field it will not create class field for each new child table.
------------------------------------------------------------------------------------------------------------------------------------------------------------
36)Can you give me 10 field types?
Answer)Reference,String,List,Choice,email,date/time,date,true/false,integer,journal,attachment
------------------------------------------------------------------------------------------------------------------------------------------------------------
37)What is the difference between temporary and normal table ?
Answer) temp tables will store data temp for 7 days and they will extend import set row table. normal tables will have the data permanently
------------------------------------------------------------------------------------------------------------------------------------------------------------
40)what is one to one and one to many table in ServiceNow?
Answer:
One-to-Many Relationship: Users and Incidents, where one user can have multiple incidents, but each incident is assigned to one user.
Many-to-Many Relationship: Incidents and Groups, where an incident can be associated with multiple groups, and a group can be associated with multiple
incidents.
------------------------------------------------------------------------------------------------------------------------------------------------------------
41)In how many ways we can create a record in snow table?
Answer)record producer, email, GlideRecord, form and excel sheet , from external system as well
----------------------------------------------------------------------------------------------------------------------------------------------------
42)In how many ways we can make a field mandatory, read only?
Answer)from dictionary properties, dictionary overrides, UI policies ,data policies, and g_form.setMandatory(Script) .
----------------------------------------------------------------------------------------------------------------------------------------------------
