Job Switch Kit: Everything you need to crack your next ServiceNow interview Get Job Switch Kit →
Get the complete ServiceNow interview prep system — 500+ Q&A, mock interviews & more Get Job Switch Kit →

ServiceNow Scripting Interview Questions 2026

What is the difference between Fix Script and Background Script?

1. We can check progress for Fix Script but not for Background Script.

2. We can kill running fix scripts in between but background script we cannot(Unless we go to Active Transactions via other session and kill it).

3. We can run Fix Script in background but Background script only runs in foreground.Foreground means the current session will be blocked until script execution gets completed, background process means you can keep on working on other stuffs while script runs in background.

4. Background script cannot be run for Scoped Application but Fix Script can be.

What is the purpose of setWorkflow() method?

The purpose of setWorkflow method is to enable/disable the running of further business rules that may be triggered by current update.

What is difference between initialise and newRecord method while inserting new record?

initialize(): Creates record with empty default field values.

newRecord(): creates a GlideRecord, set the default values for the fields and assign a unique id to the record.

Example :

Output :

What is the use of get method in Glide record?

The ‘get’ method is used to return first record in the result set.

The ‘get’ method can also be used when you know the sys_id of that record. It returns Boolean values based on the result.

Example 1:

var grIncident=new GlideRecord('incident');
if(grIncident.get('9e7f9864532023004247ddeeff7b121f')){
gs.print('There exist incident with sys_id 9e7f9864532023004247ddeeff7b121f');
}else{ gs.print('There is no incident with sys_id 9e7f9864532023004247ddeeff7b121f');
}

Example 2:

var grIncident=new GlideRecord('incident');
if(grIncident.get('number','INC0000601')){
gs.print('There exist incident with number INC0000601');
}else{ gs.print('There is no incident with number INC0000601');
}

How can we update records without updating system fields like Updated, Created, etc. for a particular update?

The autoSysFields is used to disable the update of ‘sys’ fields (Updated, Created, etc.).

Example Script:

var gr = new GlideRecord('incident');
gr.addQuery('category', hardware);
gr.query();
while(gr.next()){
gr.autoSysFields(false);
gr.category = 'software';
gr.update();
}

What is the necessity of script action if we already have script include to write server side script?

Script Actions are executed asynchronously while Script Includes are executed synchronously.

If there is scenario where script execution is going to take longer time then it's always better to go with Script Actions as user don't need to wait for script execution completion.

How to stop form submission on Client and Server side?

On client side, we can use 'return false'.

On server side, we use the function 'current.setAbortAction(true)'.

What are the private function in script include and how to define them?

Function names starting with underscore are considered as private functions. These functions can be called only in same script include or extended/inherited script include.

Assignment for you:

1. What is the difference between getXML(), getXMLAnswer() and getXMLWait() in GlideAjax? What are the drawbacks of using getXMLWait() function?

2. What is the best way to find difference between datetime on server side and client side?

3. How to copy attachments from one record to another?

While you're deciding, someone else applying for the same role already started their 15-day plan.

No countdown, no gimmick, just a head start you can still catch up on.

500+ Q&A — Technical + Behavioral, structured by module
15-Day Structured Roadmap — Day-by-day plan that peaks on interview day
Unlimited Interview Bot — Practice live, every session recorded and reviewable
Salary Negotiation Playbook — Counter-offers, CTC decoding, in-hand strategy
Job Switch Strategy Guide — Notice period, BGV, resignation, offer comparison
Progress Tracker + Notes — Always know exactly what to tackle next
LinkedIn Profile Optimisation — Get found by recruiters before you even apply
Catch Up →

🔒 Secure payment via Razorpay · Instant access after payment

10 days free — for your honest review

Your story could be the reason someone else lands their next ServiceNow role

If this content made a real difference in your prep, sharing that experience with your network helps other professionals discover it — and we'd love to say thank you with 10 days of premium access, completely on us.

Real Interview Questions & Answers

Questions shared by ServiceNow professionals and reviewed for clarity, relevance, and interview usefulness.

Sharique 07 Sep 2026
What are GlideSecure and GlideAttachments ?
0 helpful
*Please enter a reply
Srx 07 Jul 2024
In ServiceNow, to write a background script that closes a related RITM (Request Item) when the corresponding SC Task is closed
Veera 05 Aug 2026
var ritmGR = new GlideRecord('sc_req_item'); ritmGR.addQuery('state', '!=', 3); // Skip already Closed Complete RITMs (modify if needed) ritmGR.query(); while (ritmGR.next()) { var taskGR = new GlideRecord('sc_task'); taskGR.addQuery('request_item', ritmGR.sys_id); taskGR.addQuery('state', 'NOT IN', '3,4,7'); // Open tasks taskGR.query(); // If no open tasks exist, close the RITM if (!taskGR.hasNext()) { ritmGR.state = 3; // Closed Complete // Optional fields // ritmGR.stage = "Request Closed"; // ritmGR.close_notes = "Closed automatically as all catalog tasks are closed."; ritmGR.update(); gs.print("Closed RITM: " + ritmGR.number); } }
1 helpful
0 helpful
*Please enter a reply
Dinesh Kumar 27 Jan 2024
GlideQuery() and GlideFilter() usage
Bhargav 21 Jul 2024
The GlideQuery API is an alternative to GlideRecord to perform CRUD operations on record data from server-side scripts. The GlideFilter API is case-sensitive by default where as GlideRecord and GlideQuery queries are case-insensitive. Use the setCaseSensitive() method to enable or disable case sensitivity when using GlideFilter.
0 helpful
0 helpful
*Please enter a reply
Suneel Kumar 07 Jul 2023
How to copy attachments from one record to another? You can use glide function. GlideSysAttachment.copy('from table', current.sys_id, 'to table', dmnd.sys_id);
Navaneetha 13 Nov 2024
GlideSysAttahment.copy('source tablename', 'source table sys_id', 'target tablename', target table sys_id');
0 helpful
Astik Thombare 11 Dec 2024
var attachment = new GlideSysAttachment(); var incidentSysID = 'ab1b30031b04ec101363ff37dc4bcbfc'; var incGR = new GlideRecord('incident'); incGR.get(incidentSysID); var copiedAttachments = attachment.copy('incident', incidentSysID, 'problem', incGR.getValue('problem_id')); gs.info('Copied attachments: ' copiedAttachments);
0 helpful
3 helpful
*Please enter a reply
Satya 15 Jun 2023
What is cleanup scripts?
Suneel Kumar 07 Jul 2023
Cleanup scripts automatically run on the target instance after the cloning process finishes. Use cleanup scripts to modify or remove bad data. Cleanup scripts run after data preservers and the clone are complete.
0 helpful
0 helpful
*Please enter a reply
Satyapriya Biswal 05 Apr 2023
Why we don't use initialize function in scriptinclude while calling it from a client script using GlideAjax
Prashant 06 Apr 2023
Hi SatyaPriya, The primary use of initialize function in script include is to set default values to variables which can later be used anywhere in script include. We don't need this in client callable script include as the data which we need is normally sent via client script while using GlideAjax. Note :ServiceNow automatically removes initialize function whenever we check client callable checkbox in script include.
1 helpful
Prasad Dhumal 14 Oct 2023
When a Client Callable Script Include is created the prototype extends from the "AbstractAjaxProcessor" Class and "initialize: function() {}" will not be added since it is already in the AbstractAjaxProcessor.prototype. If we add "initialize: function() {}" into the Client Callable Script Include manually, the GlideAjax call won't work since it overrides the initialize function in the AbstractAjaxProcessor.prototype and request, responseXML, gc objects used in the Ajax call are not available
1 helpful
0 helpful
*Please enter a reply
Share a Question
?
Questions are reviewed before publishing to maintain quality. Include the role, scenario, or context if possible — specific questions are more useful to others.

🚀 Power Up Your ServiceNow Career

Join a growing community of smart ServiceNow professionals to stay ahead in interviews, sharpen your development skills, and accelerate your career.

📱

ServiceNow Buddy App

Get the free Android app for a smoother experience.

Install
Comments

No comments yet — be the first to share your thoughts!

* Please enter a comment before submitting.
📝 My Topic Notes 🔒 Only visible to you
Previous Incident Management Questions Next Notification Questions

Found these questions helpful?

Share your experience — it helps other ServiceNow professionals know what to prepare.

Share Your Story →