ServiceNow Portal Interview Questions 2025

What is Widget in Service Portal?

Widgets are reusable components which make up the functionality of a portal page. Widgets define what a portal does and what information a user sees. ServiceNow provides a large number of baseline widgets.

Examples include:
Approvals
Knowledge Base
My Requests

What is difference between widget and widget instance?

A Widget is the code template used to display content in the portal. A Widget Instance is created when a Widget is added to a Page.

Every time a Widget is added to a Page it creates a new Widget Instance. Each Instance can be configured separately, allowing the same code template to be applied to different configurations. This allows a single Widget like the Simple List Widget to render multiple different types of content like a list of Incidents, a list of Links, or a list of Change Requests.

How to pass data from one widget to another widget?

We can use $emit, $broadcast and $on to send and recieve the data.

- Example by using $broadcast

Include below code in client controller on source widget to send data.
$rootScope.$broadcast('dataEvent', data);

Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});

- Example by using $emit

Include below code in client controller on source widget to send data.
$rootScope.$emit('dataEvent', id);

Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});

Note : According to ServiceNow San diego docs, Avoid the use of $rootScope.$broadcast() because it can cause performance issues. Reference link - Using AngularJS Events with Widgets

Detailed article about widget communication : How to communicate between widgets in Service Portal

How to pass data from one portal page to another portal page?

To access data between two pages, we need to send data via URL as shown below.

Set URL as below on source page client controller :
function ($scope, $window) {
var c = this:
c.onClick = function () {
$window.location.href = "/sp?id=new_portal_page&incidentNumber=" + INC00001234;
}
}

On the server side of the target page, we can use below code to access those parameters:
var incNumber = $sp.getParameter('incidentNumber');

How to pass data from Server side to client side in widget?

We have data object to store data on server side script which later can be accessed in client script as shown in below example.

Server side script :
data.myNumber = 10;
data.myID = gs.getUserID(); //store data in myID variable

Client side script :
var userID = c.data.myID; //access stored data here

How to pass data from Client side to Server side in widget?

We can use c.server.update() method to execute server side script again where it can access client side 'data' object as 'input' object.
Example : Send incident number from client side to server side code and get associated assignment group.
Client Script Code :

function() {
/* widget controller */
var c = this;
c.data.incNumber = "INC0001234";
c.data.actionName="getIncidentAssignmentGroup"
c.server.update().then(function(response){
console.log(response.assignment_group;
});
}

Server side code :

if (input) {
if (input.actionName == "getIncidentAssignmentGroup") {
var grIncident=new GlideRecord("incident");
if(grIncident.get("number",input.incNumber){
input.assignment_group=grIncident.assignment_group;
}
}
}

Name different API's which are used in Service Portal?

Here is list of Service Portal API's that we can utilise, they are divided into two types Client Side and Server Side:

1. Service portal client side API's:

i) spAriaUtil - Show messages on a screen reader.
ii) spContextManager - Make data from a Service Portal widget available to other applications and services in a Service Portal page. For example, pass widget data to Agent Chat when it opens in a Service Portal page.
iii) spUtil - Utility methods to perform common functions in a Service Portal widget client script.
iv) spModal - Show alerts, prompts, and confirmation dialogs in Service Portal widgets. The SPModal class is available in Service Portal client scripts.

2. Service Portal server-side APIs

i) GlideSPScriptable - Interact with data and perform record operations in Service Portal widgets. We can access GlideSPScriptable methods by using the global $sp object.
ii) GlideSPSearchAnalytics - Generates search analytics from custom ServiceNow search widgets.
iii) spScriptedFacet - Define facet items, filters, or mapped queries for a facets object.
iv) spScriptedFacetService - Generate a multi choice or single choice facets object for an advanced search source.

How to refresh widget data in Service Portal if a user creates/updates/deletes a record using the standard ServiceNow UI in backend?

Record Watch is a tool that allows a widget developer to respond to table updates in real-time. For instance, by using Record Watch, the Simple List widget can listen for changes to its data table and if new records are added, removed, or updated, the widget can update itself in real-time.

e.g.

function(spUtil, $scope) { /* widget controller */ var c = this; spUtil.recordWatch($scope, "incident", "active=true", function(name, data) { console.log(name); //Returns information about the event that has occurred console.log(data); //Returns the data inserted or updated on the table }); }


Prepared and confident for your interview?

Practice makes perfect! Test your skills with our virtual interview practice buddy and ensure you're fully ready for your upcoming interview.

🎯 Start Practicing

Real Interview Questions & Answers

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

Vishal 2024-08-02 22:20:51

How to pass data from Client Script to HTML? How to pass data from the Server Script to the Client Script?


praveen 2024-12-20 00:28:54
for html {data.varariable_name} for client var result = $scope.data.variable_name;
0 Helpfuls
0 Helpfuls


PS 2024-07-18 19:25:04

What is media query?


Sakshi 2025-05-14 23:43:07
media query is used in css to give the css according to screen width.
0 Helpfuls
0 Helpfuls


Swapnil Narad 2024-06-23 00:02:07

What is the difference between c.server.update() and c.server.get() in widget's client controller ?


Divesh Jalandriya 2025-05-07 22:18:29
Use get() when you just need to load/reload data and don’t need to send any input from Client side to Server side. Use update() when you need to send data (like user input) from client to server and want the server to act on it.
1 Helpfuls
1 Helpfuls


MHR 2024-02-23 02:13:15

How can we display announcement based on user location

0 Helpfuls


MHR 2024-02-22 22:32:56

What is the difference between Service Portal and Employee Center Portal


poornashree 2024-06-17 00:03:32
Key Differences Service Portal: Broad service access, highly customizable for various users. Employee Center Portal: Tailored for employee-specific needs, combining HR, IT, and other services into one portal.
0 Helpfuls
0 Helpfuls


Swetha 2023-07-12 16:28:56

I got a question like how to show different different portals for different user roles.


Sureshmayan 2023-10-30 21:53:12
using Page route map
1 Helpfuls
Pradeep 2024-04-25 01:19:28
By modifying SPEtryPage script include
1 Helpfuls
1 Helpfuls


Mahi 2023-07-04 20:08:43

What all things are copied when you clone a widget?


Satyam 2023-08-14 23:50:03
Everything other than name and ID.
1 Helpfuls
0 Helpfuls








🚀 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.

Fuel My Passion

Loving the content? Well, of course you are. Here’s your chance to indirectly fuel the chaos that keeps this website running. Your contribution helps keep the wheels turning and allows me to continue pretending to be a responsible adult—while cranking out more content for you. Thanks for supporting my delusional dreams and helping me keep this website alive!


Buy Me a Coffee

Support with UPI

If you prefer making a UPI payment to support the website maintenance cost, scan the QR code below:

UPI QR Code

Comments