ServiceNow Interview
ServiceNow Interview
1. Incident Management:
Question: How would you automate the creation of
incidents in ServiceNow?
Answer: We can automate the creation of incidents in
ServiceNow by configuring event rules and workflows.
Here's a sample script that creates an incident when a
specific event occurs:
```javascript
// Sample script to create an incident from an event
(function() {
var event = current; // Assuming the event data is available
in the 'current' object
incident.insert();
})();
```
2. Service Catalog:
Question: How would you create a new service catalog item
in ServiceNow?
Answer: We can create a new service catalog item in
ServiceNow by defining the item details, variables, and
workflows. Here's a sample script that creates a new service
catalog item:
```javascript
// Sample script to create a new service catalog item
(function() {
var catalogItem = new GlideRecord('sc_cat_item');
catalogItem.initialize();
catalogItem.insert();
})();
```
3. Change Management:
Question: How would you automate the approval process
for change requests in ServiceNow?
Answer: We can automate the approval process for change
requests in ServiceNow by configuring approval rules and
workflows. Here's a sample script that automatically
approves change requests:
```javascript
// Sample script to automatically approve change requests
(function() {
var changeRequest = current; // Assuming the change
request data is available in the 'current' object
ci.insert();
})();
```
5. Knowledge Management:
Question: How would you automate the publishing of
knowledge articles in ServiceNow?
Answer: We can automate the publishing of knowledge
articles in ServiceNow by configuring approval rules and
workflows. Here's a sample script that automatically
publishes knowledge articles:
```javascript
// Sample script to automatically publish knowledge articles
(function() {
var knowledgeArticle = current
```javascript
// Sample script to calculate the SLA target based on priority
(function() {
var sla = new GlideRecord('contract_sla');
sla.initialize();
sla.insert();
})();
```
7. Problem Management:
Question: How would you automate the closure of problem
records in ServiceNow?
Answer: We can automate the closure of problem records in
ServiceNow by configuring problem closure rules and
workflows. Here's a sample script that automatically closes
problem records:
```javascript
// Sample script to automatically close problem records
(function() {
var problem = current; // Assuming the problem record
data is available in the 'current' object
8. Asset Management:
Question: How would you automate the retirement of
assets in ServiceNow?
Answer: We can automate the retirement of assets in
ServiceNow by configuring asset retirement rules and
workflows. Here's a sample script that automatically retires
assets:
```javascript
// Sample script to automatically retire assets
(function() {
var asset = current; // Assuming the asset data is available
in the 'current' object
9. Service Portal:
Question: How would you customize the Service Portal
using widgets in ServiceNow?
Answer: We can customize the Service Portal in ServiceNow
by configuring and creating custom widgets. Here's a sample
script that creates a custom widget:
```javascript
// Sample script to create a custom widget for the Service
Portal
(function() {
angular.module('widget.module',
[]).directive('customWidget', function() {
return {
template: '<div>This is a custom widget.</div>',
restrict: 'E'
};
});
})();
```
```javascript
// Sample script to trigger service mapping discovery
(function()
{
var discovery = new GlideDiscovery();
```javascript
// Sample script to trigger the onboarding process for a new
employee
(function() {
var employee = new GlideRecord('hr_employee');
employee.initialize();
// Set employee field values
employee.name = 'John Doe';
employee.department = 'IT'; // Set the appropriate
department
employee.insert();
```javascript
// Sample script to check software license compliance
(function() {
var softwareAsset = current; // Assuming the software
asset data is available in the 'current' object
```javascript
// Sample script to create project tasks
(function() {
var project = new GlideRecord('pm_project');
project.initialize();
project.insert();
```javascript
// Sample script to trigger vendor evaluation
(function() {
var vendor = new GlideRecord('vendor');
vendor.initialize();
vendor.insert();
gs.addInfoMessage('Vendor evaluation triggered for
vendor: ' + vendor.name);
})();
```
```javascript
// Sample script to calculate total cost
(function() {
var costItem = new GlideRecord('fm_cost_item');
costItem.initialize();
costItem.insert();
```javascript
// Sample script to correlate events
(function() {
var event1 = new GlideRecord('em_event');
event1.initialize();
// Correlate events
if (event1.name == event2.name) {
gs.addInfoMessage('Events correlated: ' + event1.name + '
and ' + event2.name);
} else {
gs.addErrorMessage('Events not correlated.');
}
})();
```
```javascript
// Sample script to schedule a report job
(function() {
var report = new GlideRecord('sys_report');
if (report.get('name', 'My Report')) {
var reportJob = new GlideRecord('sysauto_report');
reportJob.initialize();
reportJob.insert();
```javascript
// Sample script to trigger a monitoring probe
(function() {
var probe = new GlideRecord('cmdb_probe');
probe.initialize();
probe.insert();
gs.addInfoMessage('Monitoring probe triggered: ' +
probe.name);
})();
```
```javascript
// Sample script to trigger the fulfillment process for a
service request
(function() {
var request = new GlideRecord('sc_request');
request.initialize();
request.insert();
```javascript
// Sample script to trigger the provisioning of cloud
resources
(function() {
var provision = new
GlideRecord('cmdb_ci_cloud_provision');
provision.initialize();
provision.insert();
problem.insert();
gs.addInfoMessage('Problem record ' + problem.number + '
created from incident ' + incident.number);
})();
```
```javascript
// Sample script to create an incident from a change
(function() {
var change = current; // Assuming the change data is
available in the 'current' object
incident.insert();
```javascript
// Sample script to link a knowledge article to an incident
(function() {
var incident = current; // Assuming the incident data is
available in the 'current' object
knowledgeLink.link_type = 'Task';
knowledgeLink.insert();
```javascript
// Sample script to create an incident from an event
(function() {
var event = current; // Assuming the event data is available
in the 'current' object
incident.insert();
```javascript
// Sample script to link a knowledge article to a problem
(function() {
var problem = current; // Assuming the problem data is
available in the 'current' object