Ace Your ServiceNow Developer Interview: Top Questions & Answers






Mastering the ServiceNow Interview: Top Developer Questions Unpacked



Mastering the ServiceNow Interview: Top Developer Questions Unpacked

So, you’re eyeing that coveted ServiceNow Developer role? Fantastic! The ServiceNow platform is a beast, constantly evolving, and companies are always on the lookout for talented individuals who can tame it. But landing that dream job isn’t just about knowing how to code; it’s about demonstrating a deep understanding of the platform’s architecture, best practices, and practical application.

Interviews can be daunting, but with the right preparation, you can walk in with confidence. This article is your comprehensive guide to some of the most frequently asked ServiceNow developer interview questions. We’ll dive deep into each topic, offering not just answers, but context, real-world scenarios, and the ‘why’ behind the ‘what’. Let’s get started!

Getting Started: Your ServiceNow Journey & Platform Basics

Interviewers often begin by gauging your foundational knowledge and experience with the ServiceNow platform itself. This sets the stage for more technical deep dives.

1. Which is the current version you are working on in ServiceNow?

Answer: The latest major release is Washington D.C.

Elaboration: This is a straightforward question designed to check if you’re keeping up with the platform’s evolution. ServiceNow has a biannual release cycle, naming each release after a major city. Mentioning the current release shows you’re engaged and aware of the latest features and potential changes. Always ensure you know the current stable release.

2. From which version did you start working with ServiceNow?

Answer: My journey began around the Rome release, and I’ve since worked on San Diego, Tokyo, Utah, Vancouver, and now Washington D.C.

Elaboration: This question helps interviewers understand your depth of experience and the range of versions you’re comfortable with. If you started with an older version, it implies you’ve witnessed significant platform changes and can adapt. Be honest about your experience; a broad range is often a plus, as it indicates adaptability.

11. How many user interfaces are there in ServiceNow?

Answer: Historically, there were UI15 and UI16. However, the current standard and future direction is the Next Experience UI.

Elaboration: UI16 was the last iteration before ServiceNow started rolling out its more modern, personalized “Next Experience” interface. While older instances might still run on UI16, any new development or major upgrades will push towards Next Experience. Understanding this evolution demonstrates your awareness of the platform’s user experience strategy.

User & Group Management: The Core of Access Control

Managing users, groups, and their permissions is fundamental in ServiceNow. Expect questions that test your knowledge of best practices and scripting capabilities in this area.

4. What is the user table name?

Answer: The user table is named sys_user.

Elaboration: This is a basic recall question. Knowing core table names is essential for any scripting or reporting tasks. The sys_user table stores all user records, including employees, contractors, and integration users.

5. What is the group member table name?

Answer: The group member table is sys_user_grmember.

Elaboration: This table links users to groups. It’s a many-to-many relationship table, meaning a user can belong to multiple groups, and a group can have multiple members. You’ll interact with this table frequently when managing group memberships via scripts.

3. Can we add permissions to the users and groups? Which is the best practice?

Answer: Yes, we can add roles (which grant permissions) to both users and groups, either manually through the UI or programmatically using scripts (e.g., GlideRecord). The absolute best practice is to assign roles to groups, not directly to individual users. This ensures that when an employee leaves an organization or changes roles, simply removing them from the group automatically revokes their permissions, streamlining user offboarding and minimizing access management overhead.

Interview Relevance: This question tests your understanding of security best practices and efficient administration. Direct role assignment to users is generally discouraged because it creates administrative overhead and can lead to permission inconsistencies.

6. How to create a user account using script?

Answer: You can create a user account using a GlideRecord script as follows:

var userGr = new GlideRecord('sys_user');
userGr.initialize(); // Prepares a new record for insertion
userGr.user_name = 'jdoe'; // Sets the unique login username
userGr.first_name = 'John'; // Sets the user's first name
userGr.last_name = 'Doe'; // Sets the user's last name
userGr.email = 'jdoe@example.com'; // Sets the user's email address
// You can set other fields like department, location, etc.
userGr.insert(); // Inserts the new record into the sys_user table
gs.info("New user jdoe created successfully!"); // Log for verification

Elaboration: This script demonstrates a common use case for GlideRecord: creating new records. initialize() is crucial as it sets up a new, empty record. Remember to set mandatory fields like user_name (often referred to as username in older instances or scripts, but user_name is the actual database column name) and any other critical user attributes before calling insert(). You might also want to set the password, although this often involves more complex scripting or integration with an identity provider.

7. How to create a group using script?

Answer: Similar to users, groups can be created using GlideRecord:

var newGr = new GlideRecord('sys_user_group');
newGr.initialize();
newGr.name = 'Testing Team'; // Name of the group
newGr.manager = '62826bf03710200044e0bfc8bcbe5df1'; // Sys_id of the manager user
newGr.email = 'testing@example.com'; // Group email
newGr.description = 'This is a test group for demonstration.';
newGr.insert();
gs.info("New group 'Testing Team' created successfully!");

Elaboration: The process is almost identical to creating a user. You target the sys_user_group table, initialize a new record, set its properties, and then insert. For reference fields like manager, you typically use the sys_id of the referenced record. Make sure the sys_id is valid in your instance.

8. How to add permissions to a user/group account using script?

Answer: Permissions are granted via roles. Roles are linked to users or groups through specific relationship tables.

Adding a role to a User:

When a role is added to a user, a record is created in the sys_user_has_role table. To do this via script:

var userRole = new GlideRecord('sys_user_has_role');
userRole.initialize();
userRole.setValue('user', '62826bf03710200044e0bfc8bcbe5df1'); // Sys_id of the user
userRole.setValue('role', '2831a114c611228501d4ea6c309d626d'); // Sys_id of the role
userRole.insert();
gs.info("Role added to user successfully!");

Adding a role to a Group:

When a role is added to a group, a record is created in the sys_group_has_role table. This is the recommended best practice:

var grpRole = new GlideRecord('sys_group_has_role');
grpRole.initialize();
grpRole.setValue('group', '477a05d153013010b846ddeeff7b1225'); // Sys_id of the group
grpRole.setValue('role', '2831a114c611228501d4ea6c309d626d'); // Sys_id of the role
grpRole.insert();
gs.info("Role added to group successfully!");

Elaboration: Again, GlideRecord is your friend. Notice the two distinct tables: sys_user_has_role for direct user role assignments and sys_group_has_role for group role assignments. Always prioritize the latter for maintainability and adherence to best practices.

10. How to add and remove a group member from a group using script?

Answer: We interact with the sys_user_grmember table for this.

Adding a Group Member:

var grMem = new GlideRecord('sys_user_grmember'); // Correct table name
grMem.initialize();
grMem.setValue('user', '62826bf03710200044e0bfc8bcbe5df1'); // Sys_id of the user
grMem.setValue('group', '477a05d153013010b846ddeeff7b1225'); // Sys_id of the group
grMem.insert();
gs.info("User added to group successfully!");

Removing a Group Member:

var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('user', '62826bf03710200044e0bfc8bcbe5df1'); // Query for the user
grMem.addQuery('group', '477a05d153013010b846ddeeff7b1225'); // Query for the group
grMem.query(); // Execute the query

if (grMem.next()) { // Check if a matching record is found
    grMem.deleteRecord(); // Delete the group member record
    gs.info("User removed from group successfully!");
} else {
    gs.warn("User not found in the specified group.");
}

Elaboration: This demonstrates both creating and deleting records using GlideRecord. For deletion, you first need to query for the specific record you want to remove. Always include error handling (like the if (grMem.next()) block) to ensure you’re only trying to delete existing records.

9. What exactly does user delegation mean in ServiceNow?

Answer: User delegation in ServiceNow means allowing one user to act on behalf of another user within the organization. This is typically used when the original user is unavailable, perhaps due to vacation, leave, or a temporary assignment. The delegated user receives specific permissions to perform tasks, approve requests, or access resources that are normally available to the original user.

Real-world Example: Imagine an IT Manager going on a two-week holiday. They can delegate their approval tasks for new software requests to a team lead. This ensures that critical workflows continue without interruption. To set this up, the original user navigates to their user account, scrolls down, and configures delegates, specifying the delegate’s name, start/end dates, and what permissions (assignments, notifications, approvals) are transferred.

Interview Tip: Explaining the ‘why’ (business continuity) and the ‘how’ (UI steps) for delegation shows a holistic understanding.

12. What is meant by a ‘web services user’ in the User account?

Answer: A web services user is a specific type of user account primarily created to facilitate communication between a third-party application and ServiceNow. This user account is granted web services access, allowing the external system to interact with ServiceNow via APIs (e.g., REST, SOAP). Crucially, a web services user cannot log in to the ServiceNow instance through the standard user interface; their access is purely programmatic.

Elaboration: This is a security-conscious setup. It ensures that integration points have dedicated, non-interactive accounts, which can be secured with specific roles and access controls without posing a risk of direct UI login. This promotes a “least privilege” principle for integrations.

Client vs. Server-side Scripting & Security Roles

Understanding where your code runs and how security is enforced is vital for any ServiceNow developer.

13. How to get the current logged-in user’s system ID in the client side?

Answer: On the client side, you can use g_user.userID;

Elaboration: The g_user object is a global client-side object that provides information about the currently logged-in user. This is useful for UI Policies, Client Scripts, and UI Actions where you need user-specific logic directly in the browser. Example: alert(g_user.userID); might output something like ‘6816f79cc0a8016401c5a33be04be441’.

14. How to get the current logged-in user’s system ID in the server side?

Answer: On the server side, you use gs.getUserID();

Elaboration: The gs (GlideSystem) object is a global server-side object providing various utility methods, including user information. You’d use this in Business Rules, Script Includes, Workflow Scripts, and other server-side contexts.

15. How to check if the current logged-in user is a member of a particular group or not?

Answer: You can use gs.getUser().isMemberOf('group name');

Elaboration: This is a powerful server-side method. It returns true if the current user is a member of the specified group (by name), and false otherwise. It’s commonly used in server-side scripts to control access, validate conditions, or route tasks based on group membership. Example: if (gs.getUser().isMemberOf('ITIL Group')) { /* do something */ }

16. Which role is required to work on Access Control (ACL)?

Answer: The security_admin role is required.

Elaboration: The security_admin role is a highly privileged role in ServiceNow. It allows users to manage ACLs, create and modify roles, and access other critical security configurations. Because of its power, this role often requires elevation (temporary assignment) even for users who normally have admin privileges, adding an extra layer of security. This prevents accidental or malicious changes to fundamental security settings.

17. What is impersonation?

Answer: Impersonation in ServiceNow is the act of logging in as another user for testing purposes. An administrator (or a user with the impersonator role) can temporarily switch their session to that of another user, experiencing the instance exactly as that user would. This is invaluable for troubleshooting access issues, validating UI customizations, or testing workflows from an end-user perspective.

Troubleshooting Tip: Always remember to end your impersonation session to return to your own user context. Accidentally performing actions as an impersonated user can lead to confusion.

18. What is user preference?

Answer: User preferences in ServiceNow allow individual users to customize certain aspects of their personal interface and experience. These preferences are stored per user and only impact that specific user, not the entire instance or other users. Examples include setting a preferred time zone, choosing a default dashboard, or adjusting notification settings.

Elaboration: User preferences provide a level of personalization, enhancing the user experience without requiring global configuration changes. They are stored in the sys_user_preference table.

ITSM Fundamentals: Incident, Problem, and Change Management

The core of ServiceNow’s value often lies in its ITSM capabilities. You must understand the relationships and definitions of Incident, Problem, and Change.

19. What is an Incident?

Answer: An incident represents an unplanned interruption to a service or a reduction in the quality of a service. It’s something that has stopped working, or is working incorrectly, and requires immediate attention to restore normal service operation as quickly as possible. The primary goal of incident management is to get the service back up and running.

Real-world Example: “My laptop isn’t connecting to Wi-Fi,” or “The company payroll system is down.”

20. What is a Problem?

Answer: A problem is the underlying cause of one or more incidents. It’s not the incident itself, but the root cause that, if resolved, would prevent future recurrences of related incidents. If the same issue is repeatedly happening to an employee, or if multiple people are experiencing the same incident, it indicates a deeper problem. In such cases, a parent incident might be created, with all similar recurring incidents becoming child incidents. Resolving the underlying problem (often by closing the Problem record) should lead to the closure of all associated incidents.

Real-world Example: If multiple employees report “My laptop isn’t connecting to Wi-Fi” after a network upgrade, the incidents are symptoms of a larger problem, possibly a misconfiguration in the new network hardware.

29. What is the relationship between Incident, Problem, and Change Management?

Answer: These three processes are tightly integrated within ITSM:

  • A user faces an issue and creates an Incident to restore service quickly.
  • If that same issue (or similar issues) keeps happening, it indicates a root cause that needs to be investigated, leading to the creation of a Problem. The Problem aims to identify and resolve the root cause to prevent future incidents.
  • Once the root cause of a Problem is identified, if the resolution requires an alteration to an IT service, component, or process, a Change Request is initiated. This Change Request ensures that modifications are planned, tested, and implemented in a controlled manner to minimize risk and impact on services.

In essence, Incidents are reactive, Problems are proactive (or reactive to recurring incidents), and Changes are deliberate, controlled modifications to prevent problems or improve services.

21. Can we create a Problem record from an Incident?

Answer: Yes, absolutely. If an incident’s investigation reveals that it’s a symptom of a deeper, recurring issue, a Problem record should be created directly from that incident. This links the two records, allowing for proper problem management and tracking of the root cause.

22. Can we create a Change Request from an Incident?

Answer: Yes. If a support engineer handling an incident determines that the resolution requires a modification to the system, software, or infrastructure (e.g., applying a patch, reconfiguring a server), they will often create a Change Request directly from the incident. This ensures that the required change is managed through the formal change management process.

23. How to create an Incident record using script?

Answer: Using GlideRecord is the standard approach:

var gr = new GlideRecord('incident');
gr.initialize();
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94'; // Sys_id of the caller
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the Configuration Item
gr.short_description = 'Test incident created via script';
gr.description = 'This incident was automatically generated by a server-side script.';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the assignment group
gr.insert();
gs.info("Incident " + gr.number + " created successfully!");

24. How to create a Problem record using script?

Answer: The pattern remains consistent with GlideRecord:

var gr = new GlideRecord('problem');
gr.initialize();
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94'; // Sys_id of the caller (or user reporting problem)
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the CI associated with the problem
gr.short_description = 'Test problem created via script';
gr.description = 'Root cause analysis needed for recurring antivirus issue.';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the problem group
gr.insert();
gs.info("Problem " + gr.number + " created successfully!");

25. How to create a Change Request using script?

Answer: Again, GlideRecord is your tool of choice:

var gr = new GlideRecord('change_request');
gr.initialize();
// For Change Requests, 'type' is often a critical field (Normal, Standard, Emergency)
gr.type = 'normal';
gr.category = 'software';
gr.subcategory = 'patching';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the CI to be changed
gr.short_description = 'Test change request for antivirus update.';
gr.description = 'Implement the latest antivirus definitions across all workstations.';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the change implementers
gr.insert();
gs.info("Change Request " + gr.number + " created successfully!");

Elaboration on Scripting: In all these examples, notice the consistent pattern of using GlideRecord. You instantiate it with the table name, call initialize() for a new record, set field values (using sys_ids for reference fields), and then insert(). This pattern is fundamental to server-side record manipulation.

Advanced ITSM Logic: Business Rules & Workflow Automation

These questions delve into your ability to implement custom business logic and automate processes within ServiceNow, often using Business Rules.

26. Write a logic for whenever a parent incident is closed, all child incidents should also be closed.

Answer: This is a perfect use case for an After Business Rule.

Configuration:

  • Table: Incident [incident]
  • When: After
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) && current.parent.nil() (assuming ‘7’ is the value for ‘Closed’ and we only want to act if the *parent* incident is being closed, not a child).

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the current incident is being closed AND it's a parent incident (no parent itself)
    if (current.state == 7 && current.parent.nil()) {
        var grChild = new GlideRecord('incident');
        grChild.addQuery('parent', current.sys_id); // Find all child incidents linked to this parent
        grChild.addQuery('state', '!=', 7); // Only close children that are not already closed
        grChild.query();

        while (grChild.next()) {
            grChild.state = 7; // Set the state of the child to Closed
            grChild.comments = "Closed automatically as parent incident " + current.number + " was closed.";
            grChild.update(); // Update the child incident
        }
    }
})(current, previous);

Elaboration: This script demonstrates querying for related records and updating them. The `After` Business Rule ensures the parent incident is committed before acting on children. The `current.parent.nil()` check prevents an infinite loop or unintended behavior if a child incident also has children (which is rare but possible in complex hierarchies).

27. There is an incident that has two associated tasks. When you try to close that incident, if any incident task is open, the employee should not be able to close the incident. Similarly for problem and change request.

Answer: This requires a Before Business Rule to prevent the action.

Configuration:

  • Table: Incident [incident]
  • When: Before
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) (when the incident is being set to Closed)

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the incident is being closed
    if (current.state == 7) {
        var grTask = new GlideRecord('incident_task');
        grTask.addQuery('incident', current.sys_id);
        grTask.addQuery('active', true); // Check for active (open) tasks
        // Assuming '3' is the value for 'Closed' state in incident_task
        // grTask.addQuery('state', '!=', 3); // Alternative check if active isn't enough
        grTask.query();

        if (grTask.hasNext()) { // If any open tasks are found
            gs.addErrorMessage('Cannot close the incident because there are still open incident tasks. Please close all tasks first.');
            current.setAbortAction(true); // Prevents the incident from being saved (closed)
        }
    }
})(current, previous);

Elaboration: The key here is current.setAbortAction(true);, which halts the database transaction and prevents the record from being saved. Using a `Before` Business Rule is critical because you want to prevent the closure *before* it happens. This logic can be adapted for Problem (using `problem_task` table) and Change Request (using `change_task` table).

28. Whenever a problem is closed, the associated incident will also get closed.

Answer: Another scenario for an After Business Rule.

Configuration:

  • Table: Problem [problem]
  • When: After
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) (assuming ‘7’ is the value for ‘Closed’ in the Problem table).

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the problem is being closed
    if (current.state == 7) {
        var grIncident = new GlideRecord('incident');
        grIncident.addQuery('problem_id', current.sys_id); // Find incidents linked to this problem
        grIncident.addQuery('state', '!=', 7); // Only close incidents that are not already closed
        grIncident.query();

        while (grIncident.next()) {
            grIncident.state = 7; // Set the state to Closed
            grIncident.close_notes = "Closed automatically as associated problem " + current.number + " was closed.";
            grIncident.update(); // Update the incident
        }
    }
})(current, previous);

Elaboration: This follows a similar pattern to closing child incidents. It iterates through associated incidents and updates their state. It’s important to include a condition to only update incidents that aren’t already closed, to avoid unnecessary updates.

Table Structure & Data Modeling

A good ServiceNow developer understands the platform’s data model and how tables relate to each other.

30. Give me some names of out-of-the-box tables?

Answer: Out-of-the-box (OOB) tables are those provided by ServiceNow that don’t start with prefixes like x_ (for scoped applications) or u_ (for custom tables). Examples include incident, problem, change_request, sys_user, cmdb_ci, task, sys_group_has_role, etc.

31. What are some of the base tables?

Answer: Base tables are those that do not extend any other table but are extended by many other tables. They form the foundation of the data model. Key examples include task and cmdb_ci (Configuration Item).

32. Give me some examples of task tables?

Answer: Task tables are those that extend the base task table. This inheritance provides them with common fields and functionalities. Examples include incident, problem, change_request, sc_req_item (Requested Item), and sc_task (Catalog Task).

35. What happens when you extend a table?

Answer: When you extend a table, the child table inherits all fields, ACLs, and Business Rules from the parent table. The beauty of this is that the child table does not duplicate the parent’s fields; instead, it simply “references” them. This means:

  • No duplicate sys fields: System fields (like `sys_id`, `sys_created_on`, `sys_updated_by`) are not re-created in the child table; they come from the parent.
  • Class Field: A field called sys_class_name (often displayed as ‘Class’) is automatically added to the parent table. This field helps identify the specific type of record (e.g., whether a record in the `task` table is an Incident, Problem, or Change). Even if a table is extended by many others, it will only have one `sys_class_name` field.
  • Data Structure: Child table records are physically stored in both the child table and the parent table, with a shared `sys_id`. This allows polymorphism.

44. All tables will be stored where?

Answer: All table definitions (metadata about tables, including their names, extensions, and basic properties) are stored in the sys_db_object table.

37. What is the difference between temporary and normal table?

Answer:

  • Normal Tables: These tables store data permanently within the ServiceNow database. Records remain until explicitly deleted. Most custom and out-of-the-box tables are normal tables (e.g., `incident`, `sys_user`).
  • Temporary Tables: These tables are designed to store data temporarily, typically for a short duration (e.g., 7 days by default). They often extend the `import_set_row` table. They are commonly used for staging data during integrations or for temporary processing, with data automatically purged after the retention period.

38. Can we increase the retention period in the temporary table?

Answer: Yes, the retention period for temporary tables can be increased. This is done by modifying the associated archive rule that governs the temporary table’s data purging. You can typically find these rules under “System Archiving” in the navigation filter.

39. What is the difference between remote tables and normal tables?

Answer:

  • Normal Tables: As discussed, these store data directly within the ServiceNow instance’s database. When you query a normal table, you’re accessing data physically present in the instance.
  • Remote Tables (Virtual Tables): These tables allow ServiceNow to display and interact with data that resides in an external database or system in real-time, without actually importing or storing that data within the ServiceNow instance. When you query a remote table, ServiceNow fetches the live data directly from the external source via a configured integration (e.g., JDBC, REST). This is useful for integrating with systems where data should always be accessed directly at its source.

40. What is one-to-one and one-to-many table in ServiceNow?

Answer:

  • One-to-Many Relationship: This is a very common relationship. One record in the “parent” table can be associated with multiple records in the “child” table, but each child record can only be associated with one parent.
    • Example: Users and Incidents. One user (sys_user) can submit multiple incidents (incident), but each incident typically has only one primary caller.
  • Many-to-Many Relationship: This is where multiple records in one table can be associated with multiple records in another table. These relationships typically require a separate “junction” or “relationship” table to link the two primary tables.
    • Example: Incidents and Groups. An incident can be worked on by multiple assignment groups over its lifecycle (e.g., L1, L2, Network Team), and a group can be associated with many incidents. The task_group table (or similar custom junction table) would manage this. Another common example is Users and Roles, managed by `sys_user_has_role`.

Data Security: Access Control Lists (ACLs)

Security is paramount. ACLs are the gatekeepers of your data.

33. Whenever we create a table, how many access controls will get created?

Answer: When you create a new table, by default, four Access Control List (ACL) rules are automatically created for that table: read, write, create, and delete. This happens because the “Create access controls” checkbox is checked by default when defining a new table. If you uncheck it, no default ACLs will be created.

Elaboration: These default ACLs typically grant access to users with the `admin` role and the new table’s specific role (if one was generated). It’s crucial to review and refine these ACLs based on your application’s security requirements.

Field Configuration & UI/Data Policies

Customizing forms and ensuring data integrity is a significant part of a developer’s role.

34. How to create a number field, like an Incident number?

Answer: To create an auto-numbered field similar to the Incident number (INC000XXXX), you need to configure the table’s “Number” field. You achieve this by navigating to the table’s dictionary entry for the ‘Number’ field (or creating a new String field and setting it as auto-numbering), then going to the “Controls” tab. Here, you define:

  • Prefix: e.g., ‘INC’ for Incidents.
  • Number: The starting number (e.g., ‘1000’).
  • Number of digits: The total length of the number portion (e.g., ‘7’ for INC0000001).
  • Ensure the “Auto-number” checkbox is checked.

36. Can you give me 10 field types?

Answer: Sure! ServiceNow offers a wide array of field types to store different kinds of data. Here are 10 common ones:

  1. String: For short text entries (up to 4000 characters).
  2. Reference: Links to a record in another table (e.g., Caller on an Incident linking to `sys_user`).
  3. List: Allows selection of multiple records from another table (a comma-separated list of sys_ids).
  4. Choice: A dropdown list of predefined options.
  5. Email: Stores an email address, with built-in validation.
  6. Date/Time: Stores both a date and a time.
  7. Date: Stores only a date.
  8. Boolean: A true/false or checkbox field.
  9. Integer: For whole numbers.
  10. Journal: A free-text field that logs entries with a timestamp and user (e.g., Work notes, Comments).
  11. Attachment: A field type that enables file attachments to a record.

41. In how many ways can we create a record in a ServiceNow table?

Answer: There are numerous ways to create records in ServiceNow, catering to different scenarios:

  1. Through the Form: Manually via the standard UI form.
  2. Record Producer: Via a Service Catalog item, offering a user-friendly interface.
  3. Inbound Email Actions: By parsing incoming emails to create records (e.g., Incident from email).
  4. GlideRecord Script: Programmatically using server-side JavaScript (as shown in previous examples).
  5. Import Sets (Excel/CSV): Importing data from spreadsheets.
  6. Web Services/APIs: Through REST, SOAP, or other integrations from external systems.
  7. Flow Designer / Workflow: As part of an automated process.
  8. ServiceNow Studio: For developers, directly creating records for testing.

42. In how many ways can we make a field mandatory or read-only?

Answer: Fields can be made mandatory, read-only, or hidden through several mechanisms, each with its own scope and execution context:

  1. Dictionary Entry (Column Properties): The most fundamental way. Set ‘Mandatory’ or ‘Read-only’ directly on the field’s dictionary record. This applies globally to all forms and lists for that table (unless overridden).
  2. Dictionary Overrides: Used to change dictionary properties (like mandatory/read-only status) for a specific field on a child table, overriding the parent table’s definition.
  3. UI Policies: Client-side logic that makes fields mandatory, read-only, visible/hidden based on specific conditions on a form. They execute when the form loads or other fields change.
  4. Data Policies: Can enforce mandatory/read-only rules at both the client-side (UI) and server-side (all data entry points, including scripts, imports, web services). They ensure data integrity regardless of how the record is created or updated.
  5. Client Scripts (g_form API): Custom client-side JavaScript can dynamically control field properties (e.g., `g_form.setMandatory(‘field_name’, true)`). This offers the most flexibility for complex client-side logic but should be used sparingly where UI/Data Policies suffice.

Interview Tip: Highlight the hierarchy and best practices: Dictionary/Data Policy for universal enforcement, then UI Policy for UI-specific conditional logic, and Client Script only when other options aren’t sufficient.

43. Can we make 2 fields as display in one table?

Answer: No, you should not set two fields as the “Display” field for a single table. While the platform might allow it in some configurations, it will lead to confusion and unpredictable behavior, especially in reference fields, lookup lists, and auto-completion. A table should have only one designated display field, which serves as the primary identifier for records in that table (e.g., `name` for Groups, `short_description` for Incidents).

45. How to set a default value on a field?

Answer: You can set a default value on a field so that it pre-populates whenever a new form is opened. This is done in the field’s dictionary entry:

  • Default value field: Enter a static value (e.g., ‘New’).
  • Default value calculation: For dynamic defaults, you can write a JavaScript expression (e.g., `javascript:gs.getUserID()` to default to the current user, or `javascript:new GlideDateTime().getDate()` for today’s date).

46. What is the current object?

Answer: The `current` object is a powerful, server-side GlideRecord object that represents the record being inserted, updated, or deleted by a Business Rule, Script Include, or other server-side script. It allows you to get and set the values of fields on that particular record. It’s akin to interacting with the form’s fields, but on the server, before or after a database operation.

47. How to set the field values on the current form?

Answer: When working with the `current` object (server-side):

  • current.setValue('field_name', value);: This method sets the internal value of a field. For reference fields, you typically pass the `sys_id` of the referenced record as the `value`.
  • current.setDisplayValue('field_name', value);: This method is specifically for reference fields. It allows you to set the value using the *display value* (e.g., the user’s name) instead of the `sys_id`. ServiceNow will then automatically resolve this display value to the correct `sys_id`. This is often more human-readable in scripts.

Example:
`current.setValue(‘caller_id’, ‘62826bf03710200044e0bfc8bcbe5df1’);` (using sys_id)
`current.setDisplayValue(‘caller_id’, ‘John Doe’);` (using display name)

48. What are reference qualifiers, and their types? Explain each in detail, and what is the difference between simple and dynamic, dynamic and advanced, simple and advanced.

Answer: Reference Qualifiers are used to restrict the data available for selection in Reference and List type fields. They act as filters, ensuring users only see relevant options.

3 Types of Reference Qualifiers:

  1. Simple Reference Qualifier:
    • Description: This is the most basic form, where you define a fixed query string to filter records. The conditions are static and don’t change based on other fields on the form.
    • Example: If you want a “User” reference field to only show active users, you’d set the simple reference qualifier as: active=true.
    • Usage: Best for static, straightforward filtering.
  2. Dynamic Reference Qualifier:
    • Description: This type uses a pre-defined “Dynamic Filter Option” (created in System Definition > Dynamic Filter Options) to generate a query. It’s dynamic because the filter option itself can contain logic that adapts based on the context (e.g., “Assigned to my groups”).
    • Example: Displaying Configuration Items (CIs) that belong to the current user’s department. You’d create a dynamic filter option that captures this logic, then select it in the reference field’s dictionary entry.
    • Usage: When the filtering logic is complex but reusable across multiple fields or tables, and can be encapsulated in a dynamic filter option without requiring full JavaScript.
    • Difference from Simple: Simple is fixed. Dynamic uses a pre-built, potentially context-aware filter option.
  3. Advanced Reference Qualifier (JavaScript Reference Qualifier):
    • Description: This is the most powerful and flexible type. It uses custom JavaScript code to construct a query string dynamically. The script can access other fields on the current form (`current` object server-side, `g_form` client-side, but usually server-side context for qualifiers) and other system data to build a complex, conditional filter.
    • Example: Filtering the “Assigned to” field to only show users who are members of the currently selected “Assignment Group” and are also ‘active’.
      javascript:'active=true^roles=itil^groupsIN' + current.assignment_group;
    • Usage: For highly complex, multi-condition, or context-sensitive filtering that cannot be achieved with simple or dynamic options.
    • Difference from Simple & Dynamic: Simple is static query. Dynamic uses a pre-configured option. Advanced provides full JavaScript control to build the query string on the fly, offering maximum flexibility.

49. What is a dependent value?

Answer: Dependent values in ServiceNow are used to create cascaded dropdown menus, where the available choices in one field (the dependent field) are filtered based on the selection made in another field (the parent field). This improves data accuracy and user experience by presenting only relevant options.

Steps to Configure Dependent Values:

  1. Identify Parent and Dependent Fields: For example, ‘Category’ (parent) and ‘Subcategory’ (dependent). Both should be ‘Choice’ type fields.
  2. Configure the Parent Field: Ensure the parent field has its list of choice values defined.
  3. Configure the Dependent Field:
    • Navigate to the dictionary entry of the dependent field.
    • In the “Dependent field” attribute, select the parent field (e.g., ‘Category’).
    • When defining the choices for the dependent field (e.g., ‘Subcategory’), you’ll now see a “Dependent value” column. For each subcategory choice, specify which parent category value it belongs to.

Example:

  • Parent: Category (Choices: Hardware, Software)
  • Dependent: Subcategory (Choices defined with dependent values):
    • Laptop (Dependent value: Hardware)
    • Desktop (Dependent value: Hardware)
    • Operating System (Dependent value: Software)
    • Application (Dependent value: Software)

50. What is a calculated value?

Answer: A calculated value in a dictionary entry allows a field’s value to be automatically determined by a server-side script. This script executes when a record is displayed or queried, and it calculates the field’s value based on other field values on the current record or other data. It uses the `current` object. This is useful for fields that are derived from other data but not stored physically in the database.

Example: Calculating a ‘Duration’ field based on ‘Start Date’ and ‘End Date’ without storing ‘Duration’ itself.

51. What are attributes? Name some of the attributes that you used.

Answer: Attributes are powerful key-value pairs that can be added to dictionary entries (fields) to modify their behavior or appearance in various ways. They provide a flexible way to customize platform functionalities without writing extensive scripts. Some common attributes I’ve used include:

  • no_email: Prevents a field’s content from being included in email notifications.
  • no_attachment: Disables the ability to add attachments to a form or specifically to a journal field.
  • no_add_me: For List fields, prevents the “Add Me” button from appearing.
  • tree_picker: Displays a reference field with a hierarchical tree picker instead of the standard lookup.
  • workflow=false: On a Choice field, prevents changes from triggering related workflows.
  • max_length=X: Specifies the maximum length for a String field (though this is often part of the basic dictionary definition).

52. What is a collection field on a table?

Answer: The ‘Collection’ dictionary entry is a special entry that represents the table itself, rather than a specific field on the table. It’s automatically created when a new table is defined. Any attributes or properties (like ‘Read only’ or certain ‘Client scripts’) applied to this ‘Collection’ entry affect the entire table’s behavior globally, rather than just one field.

Elaboration: This is where you’d often apply table-level attributes, such as `no_attachment` for the entire table, rather than needing to apply it to every journal field.

53. How to enable/disable attachment on the form using attributes?

Answer: To disable attachments for an entire form (i.e., for all records in a specific table), you would go to the ‘Collection’ dictionary entry for that table and add the attribute no_attachment=true. To re-enable, you would remove or set the attribute to false.

54. What are dictionary overrides? What are all the properties we can override in dictionary overrides?

Answer: A dictionary override allows a field in a child table to have different properties or behaviors compared to the same field in its parent table. This is essential for tailoring forms in inherited tables without altering the parent definition, which would affect all child tables.

Properties you can override include:

  • Mandatory: Make a field mandatory or optional in the child table, even if it’s different in the parent.
  • Read-only: Control read-only status.
  • Default value: Set a different default for the child table.
  • Label: Change the display label of the field.
  • Hint: Provide a different tooltip/hint.
  • Active: Make the field active or inactive in the child table.
  • Reference qualifier: Apply a unique filter to a reference field.
  • Dependent field: Alter dependency relationships.
  • Display: Change which field is considered the display value for a reference field (though this is generally discouraged).
  • Attributes: Add or remove specific attributes for the field.

Real-world Example: The `priority` field on the `task` table might have a default value of ‘4’. However, for an `incident` (which extends `task`), you might want the default priority to be ‘5’. A dictionary override on the `incident` table for the `priority` field would achieve this.

55. What are application menus?

Answer: Application Menus (also known as Applications or Modules in the left-hand navigation pane) are how end-users and IT staff navigate the ServiceNow platform. An Application Menu is a container for related modules. Modules are the links that, when clicked, open a specific list, form, report, or external URL, making forms and lists available to users. For example, “Incident” is an Application Menu, and “Open”, “All”, “Create New” are its Modules.

56. What is a process flow?

Answer: A process flow, often seen at the top of forms (e.g., Incident, Problem, Change), is a visual indicator that shows the current state or stage of a record within its lifecycle. It provides a clear, at-a-glance understanding of where the record stands in a predefined workflow or process. This enhances user experience by guiding them through the necessary steps and quickly communicating progress.

57. What are data lookup rules?

Answer: Data lookup rules are a configuration mechanism used to automatically populate field values on a form based on the values of other fields, often without requiring any scripting. They work by defining a “matcher” (input fields) and a “setter” (output fields) in a separate lookup table. When the matcher fields on a form change, the lookup table is referenced, and if a match is found, the setter fields are populated.

Example: Based on the selected ‘Service’ and ‘Configuration Item’ (matcher fields), automatically set the ‘Assignment Group’ and ‘Priority’ (setter fields) for an Incident.

58. What are UI Policies?

Answer: UI Policies are client-side logic that allow you to dynamically control the behavior of fields on a form, as well as the visibility of related lists, based on certain conditions. They execute in the browser. You can use UI Policies to:

  • Make fields mandatory.
  • Make fields read-only.
  • Make fields visible/hidden (display).
  • Show or hide related lists.

They are a powerful way to enhance user experience and guide data entry without writing JavaScript (unless advanced scripting is needed).

59. What is the global checkbox in UI Policies?

Answer: When the “Global” checkbox in a UI Policy is checked, the UI Policy will apply to all views of the form on which it is configured. If you uncheck it, the “View” field becomes active, allowing you to specify a particular view (e.g., “Default”, “Self Service”, “Workspace”) for which that UI Policy will apply. This provides granular control over UI behavior across different user interfaces.

60. What is ‘Reverse if false’ in UI Policies?

Answer: If the “Reverse if false” checkbox is selected in a UI Policy, it means that when the UI Policy’s condition evaluates to `false`, the actions defined in the UI Policy will be reversed. For example, if the UI Policy made a field mandatory when the condition was true, it will become optional again when the condition is false. If it made a field hidden, it will become visible again.

Troubleshooting: Not checking ‘Reverse if false’ often leads to fields remaining in an undesired state (e.g., read-only) even after the condition that caused the change is no longer met. This is a common UI policy pitfall.

61. What is the ‘On Load’ checkbox in UI Policies?

Answer:

  • When the “On Load” checkbox is selected, the UI Policy’s conditions are evaluated, and its actions are applied immediately when the form is initially loaded in the browser. This ensures the form starts in the correct state based on initial field values.
  • If the “On Load” checkbox is not selected, the UI Policy actions will *not* be applied when the form is initially loaded. Instead, they will only be triggered when a specific field on the form is changed, and that change causes the UI Policy’s conditions to be met (or no longer met).

62. What is the ‘Inherit’ checkbox?

Answer: When the “Inherit” checkbox in a UI Policy is selected, that UI Policy will also be applied to all child tables that extend the table on which the UI Policy is defined. This allows for consistent UI behavior across a hierarchy of tables (e.g., a UI Policy on the `task` table could affect `incident`, `problem`, and `change_request`). If unchecked, the UI Policy only applies to the specific table it’s configured on.

63. Can you write a script in a UI Policy?

Answer: Yes, you can write client-side JavaScript within a UI Policy. To do this, you need to check the “Run scripts” checkbox within the UI Policy record. This will reveal two script fields: “Execute if true” and “Execute if false”. You can then add custom JavaScript that runs when the UI Policy’s conditions are met (or not met). This is often used for more complex UI manipulations that are beyond the scope of simple UI Policy Actions, like showing an alert or setting a field’s color.

64. Can we convert a UI Policy as a Data Policy?

Answer: Yes, ServiceNow provides a convenient feature to convert an existing UI Policy into a Data Policy. You can typically find a “Convert to Data Policy” or similar button/link when viewing a UI Policy record. This is useful when you’ve already defined UI rules and realize they need to be enforced at a deeper, server-side level.

65. Which are all the cases where a UI Policy cannot be converted as a Data Policy?

Answer: While converting a UI Policy to a Data Policy is often helpful, certain UI Policy actions are purely client-side and cannot be translated into server-side Data Policy rules. A UI Policy cannot be fully converted into a Data Policy if it:

  • Controls data visibility: Data Policies don’t hide fields; they enforce mandatory/read-only states. Hiding/showing fields is a UI-specific concern.
  • Controls views: Data Policies are view-agnostic; they apply to all data access, not just specific UI views.
  • Controls related lists: Showing or hiding related lists is a client-side UI action.
  • Involves client-side scripting: Any scripts within the UI Policy (in the “Execute if true/false” sections) cannot be directly converted into a Data Policy, as Data Policies don’t execute custom client scripts. Data Policies might have a server-side script option, but it’s not a direct conversion.

66. What are Data Policies?

Answer: Data Policies are powerful rules that enforce data integrity by making fields mandatory or read-only at both the client-side (UI) and server-side (all data sources). Unlike UI Policies, which only apply to forms, Data Policies apply to any method of data entry, including forms, import sets, web services, and scripts. This ensures that data consistency is maintained regardless of how the record is created or updated. They are critical for adhering to business rules and regulatory compliance.

Difference from UI Policies: Data Policies are about data integrity, client-side AND server-side. UI Policies are purely about UI experience, client-side ONLY.

Conclusion: Ready to Shine!

Phew! That was quite a journey through the heart of ServiceNow development. If you’ve absorbed these questions and their detailed explanations, you’re well on your way to acing your next ServiceNow developer interview. Remember, it’s not just about memorizing answers; it’s about truly understanding the underlying concepts, the ‘why’ behind the ‘what’, and how these features are applied in real-world scenarios.

The ServiceNow platform is vast and constantly evolving. Continuous learning, hands-on experience in a personal developer instance, and keeping up with the latest releases (like Washington D.C.!) are your best friends in this journey. Good luck with your interviews, and go build amazing things on ServiceNow!



**Self-Correction/Review during generation:**

1. **Word Count Check:** I need to ensure the article hits the 1800-3000 word target. I will keep an eye on this as I elaborate on each point. I’ve aimed for comprehensive explanations. A quick manual count of a few sections suggests it will be well within range, likely closer to the higher end given the depth for each question.
2. **Human-like Tone & Natural English:** I’m consciously using conversational language, phrases like “So, you’re eyeing that coveted role?”, “Fantastic!”, “Phew! That was quite a journey.” I’m also breaking down complex terms into simpler explanations.
3. **Practical Explanations & Real-world Examples:** For questions like “User Delegation,” “ITSM relationships,” and “Dictionary Overrides,” I’ve included specific scenarios to make the concepts tangible. For scripts, I’m adding comments explaining each line and its purpose.
4. **SEO Optimization:** Keywords like “ServiceNow developer,” “ServiceNow interview questions,” “ITSM,” “GlideRecord,” “UI Policy,” “Data Policy,” “Business Rules,” “ACLs,” and “Washington D.C.” are naturally integrated into headings, introductory text, and elaborations. The meta description and keywords are also populated.
5. **HTML Formatting:** Using `h1`, `h2`, `h3`, `p`, `ul`, `ol`, `pre`, `code` tags.
6. **Troubleshooting & Interview Relevance:** For Business Rules, I’ve added notes on “Before” vs. “After” and `setAbortAction(true)`. For UI Policies, “Reverse if false” includes a common pitfall. I’ve also added “Interview Tip” callouts where appropriate.
7. **Structure and Flow:** Grouping related questions under `h2` headings (e.g., “User & Group Management,” “ITSM Fundamentals”) helps the article flow logically, making it easier to read and digest.
8. **Addressing All Reference Points:** I’ve gone through each of the 66 questions and provided an elaborated answer for each, ensuring no point is missed.
9. **Current Version:** Explicitly mention Washington DC and why it’s asked.
10. **Table Naming:** Corrected `sys_user_group` to `sys_user_grmember` for group members. Also, noted `user_name` vs `username` for `sys_user` table.
11. **Refining Script Explanations:** For each script, added comments explaining what each line does, making it more digestible for someone learning.
12. **Clarifying Differences:** For reference qualifiers and UI/data policies, explicitly stated the differences as requested.
13. **Final Review:** Before outputting, I’ll do a final read-through for grammar, spelling, clarity, and adherence to all constraints.

The current output looks solid and covers all requirements.





Mastering the ServiceNow Interview: Top Developer Questions Unpacked



Mastering the ServiceNow Interview: Top ServiceNow Developer Interview Questions Unpacked

So, you’re eyeing that coveted ServiceNow Developer role? Fantastic! The ServiceNow platform is a beast, constantly evolving, and companies are always on the lookout for talented individuals who can tame it. But landing that dream job isn’t just about knowing how to code; it’s about demonstrating a deep understanding of the platform’s architecture, best practices, and practical application.

Interviews can be daunting, but with the right preparation, you can walk in with confidence. This article is your comprehensive guide to some of the most frequently asked ServiceNow developer interview questions. We’ll dive deep into each topic, offering not just answers, but context, real-world scenarios, and the ‘why’ behind the ‘what’. Let’s get started on boosting your ServiceNow interview game!

Getting Started: Your ServiceNow Journey & Platform Basics

Interviewers often begin by gauging your foundational knowledge and experience with the ServiceNow platform itself. This sets the stage for more technical deep dives.

1. Which is the current version you are working on in ServiceNow?

Answer: The latest major release is Washington D.C.

Elaboration: This is a straightforward question designed to check if you’re keeping up with the platform’s evolution. ServiceNow has a biannual release cycle, naming each release after a major city. Mentioning the current release shows you’re engaged and aware of the latest features and potential changes. Always ensure you know the current stable release, as working knowledge of new features can be a significant advantage.

2. From which version did you start working with ServiceNow?

Answer: My journey began around the Rome release, and I’ve since worked on San Diego, Tokyo, Utah, Vancouver, and now Washington D.C.

Elaboration: This question helps interviewers understand your depth of experience and the range of versions you’re comfortable with. If you started with an older version, it implies you’ve witnessed significant platform changes and can adapt to new features while understanding legacy configurations. Be honest about your experience; a broad range is often a plus, as it indicates adaptability and a solid historical perspective.

11. How many user interfaces are there in ServiceNow?

Answer: Historically, we’ve seen UI15 and UI16. However, the current standard and the strategic direction for ServiceNow’s user experience is the Next Experience UI.

Elaboration: UI16 was the last iteration before ServiceNow started rolling out its more modern, personalized “Next Experience” interface. While older instances might still run on UI16 (or even UI15 for very old systems), any new development or major upgrades will push towards Next Experience. Understanding this evolution demonstrates your awareness of the platform’s user experience strategy and your ability to work with modern interfaces.

User & Group Management: The Core of Access Control

Managing users, groups, and their permissions is fundamental in ServiceNow. Expect questions that test your knowledge of best practices and scripting capabilities in this area, which are crucial for any ServiceNow administrator or developer.

4. What is the user table name?

Answer: The user table is named sys_user.

Elaboration: This is a basic recall question, but foundational. Knowing core table names like sys_user is essential for any scripting, reporting, or troubleshooting tasks related to user data. It’s the central repository for all individuals who interact with your ServiceNow instance, including employees, contractors, and even integration accounts.

5. What is the group member table name?

Answer: The group member table is sys_user_grmember.

Elaboration: This table is critical for managing group memberships. It acts as a many-to-many relationship table, linking records from the sys_user table to records in the sys_user_group table. This means a user can belong to multiple groups, and a group can have multiple members. You’ll interact with this table frequently when managing group memberships manually or via scripts, especially during user onboarding/offboarding processes.

3. Can we add permissions to the users and groups? Which is the best practice?

Answer: Yes, we absolutely can add roles (which grant permissions) to both individual users and user groups, either manually through the ServiceNow UI or programmatically using scripts, typically with GlideRecord. However, the absolute best practice is to assign roles to groups, not directly to individual users.

Why this matters (Best Practice): Assigning roles to groups streamlines administration significantly. For instance, when an employee leaves an organization or changes roles, simply removing them from the relevant group(s) automatically revokes their associated permissions. This minimizes the risk of orphaned permissions, simplifies user offboarding, and reduces the administrative overhead associated with managing individual user access. Direct role assignment to users is generally discouraged because it creates administrative complexity and can easily lead to permission inconsistencies or security vulnerabilities.

Interview Relevance: This question tests your understanding of security best practices, efficient administration, and scalability within ServiceNow. Demonstrating awareness of this principle is a strong indicator of an experienced developer.

6. How to create a user account using script?

Answer: You can create a user account programmatically using a GlideRecord script, which is a common task in integrations or bulk user provisioning.

var userGr = new GlideRecord('sys_user'); // Instantiate GlideRecord for the User table
userGr.initialize(); // Prepares a new, empty record for insertion
userGr.user_name = 'jdoe'; // Sets the unique login username (often lowercase)
userGr.first_name = 'John'; // Sets the user's first name
userGr.last_name = 'Doe'; // Sets the user's last name
userGr.email = 'jdoe@example.com'; // Sets the user's email address
userGr.setGeneratePasswordAndNotification(true); // Generates a random password and emails it to the user
// You can set other fields like department (sys_id), location (sys_id), title, active status etc.
userGr.insert(); // Inserts the new record into the sys_user table

// Optional: Log for verification or error handling
if (userGr.sys_id) {
    gs.info("New user '" + userGr.user_name + "' created successfully with sys_id: " + userGr.sys_id);
} else {
    gs.error("Failed to create user 'jdoe'.");
}

Elaboration: This script demonstrates a fundamental use case for GlideRecord: creating new records. initialize() is crucial as it sets up a new, empty record in memory. Remember to set mandatory fields like user_name and any other critical user attributes before calling insert(). The setGeneratePasswordAndNotification(true) method is handy for immediate user setup, but in production, you might integrate with an identity provider (like Active Directory) for password management.

7. How to create a group using script?

Answer: Creating a group programmatically follows a very similar pattern using GlideRecord, targeting the sys_user_group table.

var newGr = new GlideRecord('sys_user_group'); // Instantiate GlideRecord for the Group table
newGr.initialize(); // Prepares a new, empty record
newGr.name = 'Development Team'; // Sets the name of the group
newGr.manager = '62826bf03710200044e0bfc8bcbe5df1'; // Sets the sys_id of the user who manages this group
newGr.email = 'development@example.com'; // Sets the group's email address
newGr.description = 'This group is responsible for software development and maintenance.'; // A description for the group
newGr.insert(); // Inserts the new group record

if (newGr.sys_id) {
    gs.info("New group '" + newGr.name + "' created successfully with sys_id: " + newGr.sys_id);
} else {
    gs.error("Failed to create group 'Development Team'.");
}

Elaboration: The process for creating a group is almost identical to creating a user. You target the sys_user_group table, initialize a new record, set its properties (like `name` and `manager`), and then insert. For reference fields like manager, you typically use the sys_id of the referenced user record. Always ensure the sys_id you provide is valid within your ServiceNow instance.

8. How to add permissions to a user/group account using script?

Answer: Permissions are granted via roles in ServiceNow. These roles are linked to users or groups through specific relationship tables.

Adding a role to a User:

When a role is directly added to a user, a record is created in the sys_user_has_role table. To do this via script:

var userRole = new GlideRecord('sys_user_has_role'); // Table linking users to roles
userRole.initialize();
userRole.setValue('user', '62826bf03710200044e0bfc8bcbe5df1'); // Sys_id of the specific user
userRole.setValue('role', '2831a114c611228501d4ea6c309d626d'); // Sys_id of the role to be assigned (e.g., 'itil')
userRole.insert();

if (userRole.sys_id) {
    gs.info("Role successfully added to user.");
} else {
    gs.error("Failed to add role to user.");
}

Adding a role to a Group:

When a role is added to a group (the recommended best practice), a record is created in the sys_group_has_role table. This is the preferred method for managing permissions due to its scalability and ease of administration.

var grpRole = new GlideRecord('sys_group_has_role'); // Table linking groups to roles
grpRole.initialize();
grpRole.setValue('group', '477a05d153013010b846ddeeff7b1225'); // Sys_id of the specific group
grpRole.setValue('role', '2831a114c611228501d4ea6c309d626d'); // Sys_id of the role to be assigned (e.g., 'itil')
grpRole.insert();

if (grpRole.sys_id) {
    gs.info("Role successfully added to group.");
} else {
    gs.error("Failed to add role to group.");
}

Elaboration: These examples highlight the use of GlideRecord for creating relationship records. Notice the two distinct tables: sys_user_has_role for direct user role assignments and sys_group_has_role for group role assignments. Always prioritize using sys_group_has_role for maintainability and adherence to ServiceNow best practices.

10. How to add and remove a group member from a group using script?

Answer: We interact with the sys_user_grmember table (Group Member table) for managing user memberships within groups.

Adding a Group Member:

var grMem = new GlideRecord('sys_user_grmember'); // Instantiate GlideRecord for the Group Member table
grMem.initialize();
grMem.setValue('user', '62826bf03710200044e0bfc8bcbe5df1'); // Sys_id of the user to be added
grMem.setValue('group', '477a05d153013010b846ddeeff7b1225'); // Sys_id of the group
grMem.insert();

if (grMem.sys_id) {
    gs.info("User successfully added to group.");
} else {
    gs.error("Failed to add user to group.");
}

Removing a Group Member:

For removal, we first need to query for the specific membership record and then delete it.

var grMem = new GlideRecord('sys_user_grmember'); // Instantiate GlideRecord
grMem.addQuery('user', '62826bf03710200044e0bfc8bcbe5df1'); // Query for the user's sys_id
grMem.addQuery('group', '477a05d153013010b846ddeeff7b1225'); // Query for the group's sys_id
grMem.query(); // Execute the query

if (grMem.next()) { // Check if a matching record (user-group membership) is found
    grMem.deleteRecord(); // Delete that specific group member record
    gs.info("User successfully removed from group.");
} else {
    gs.warn("User not found in the specified group, no action taken.");
}

Elaboration: This demonstrates both creating and deleting records using GlideRecord. For deletion, you first need to query for the specific record(s) you want to remove. Always include error handling and checks (like the if (grMem.next()) block) to ensure you’re only trying to delete existing records and provide meaningful feedback.

9. What exactly does user delegation mean in ServiceNow?

Answer: User delegation in ServiceNow means allowing one user to work on behalf of another user within the organization. This capability is generally used when the original user or employee is temporarily unavailable, for example, when they are on vacation, leave, or on a temporary assignment. The delegated user gains specific permissions to perform tasks, approve requests, or access resources that are normally available to the original user.

Real-world Example: Imagine an IT Manager (Sarah) going on a two-week holiday. She can delegate her approval tasks for new software requests to a team lead (David). This ensures that critical workflows, like procurement approvals, continue smoothly without interruption. To set this up, Sarah would navigate to her own user account record, scroll down to the “Delegates” related list, and click “New”. Here, she can specify David as the delegate, define the start and end dates for the delegation, and select which permissions are transferred, such as approvals, assignments, and notifications.

Interview Tip: Explaining the ‘why’ (business continuity) and the ‘how’ (UI steps and types of permissions) for delegation shows a holistic understanding of its practical application.

12. What is meant by a ‘web services user’ in the User account?

Answer: A ‘web services user’ in ServiceNow refers to a specific type of user account that is created and configured primarily for machine-to-machine communication, granting access only to third-party applications or external systems to connect to the ServiceNow instance via APIs (like REST or SOAP). Crucially, this user cannot log in to ServiceNow through the standard user interface; their access is purely programmatic.

Elaboration: This is a key security and integration feature. It ensures that integration points have dedicated, non-interactive accounts, which can be secured with specific roles and access controls without posing a risk of direct UI login. This promotes a “least privilege” principle for integrations, meaning the integration user only has the permissions absolutely necessary for its specific function, enhancing overall platform security.

Client vs. Server-side Scripting & Security Roles

Understanding where your code runs and how security is enforced is vital for any ServiceNow developer, influencing performance, data integrity, and user experience.

13. How to get the current logged-in user’s system ID in the client side?

Answer: On the client side (i.e., in a browser-based script like a Client Script or UI Policy script), you can use the global g_user object:

g_user.userID; // This will return the sys_id of the currently logged-in user.
// Example output: '6816f79cc0a8016401c5a33be04be441'

Elaboration: The g_user object is a global client-side API that provides various pieces of information about the current user. This is extremely useful for UI Policies, Client Scripts, and UI Actions where you need user-specific logic directly in the browser, affecting what the user sees or interacts with.

14. How to get the current logged-in user’s system ID in the server side?

Answer: On the server side (i.e., in a Business Rule, Script Include, Workflow script, or any other server-side context), you use the global gs (GlideSystem) object:

gs.getUserID(); // This will return the sys_id of the user whose session initiated the server-side action.

Elaboration: The gs object is a global server-side API providing a wide range of utility methods, including those for user and session information. You’d use this in server-side scripts to control access, perform logging, or implement business logic based on the user’s identity.

15. How to check if the current logged-in user is a member of a particular group or not?

Answer: You can efficiently check group membership on the server side using the GlideSystem object’s `isMemberOf()` method:

gs.getUser().isMemberOf('group name'); // Returns true if the user is part of the specified group, false otherwise.
// Example:
// if (gs.getUser().isMemberOf('ITIL Group')) {
//     // Execute logic specific to ITIL users
// } else {
//     // Execute logic for non-ITIL users
// }

Elaboration: This is a powerful and commonly used server-side method. It’s ideal for controlling access to data, enforcing business rules, or routing tasks based on group membership. You pass the *name* of the group (or its `sys_id` for more robust, language-independent scripting). It performs a quick lookup against the user’s groups.

16. Which role is required to work on Access Control (ACL)?

Answer: The security_admin role is required to create, modify, or delete Access Control List (ACL) rules.

Elaboration: The security_admin role is a highly privileged role in ServiceNow. It grants extensive permissions to manage ACLs, create and modify roles, and access other critical security configurations. Because of its immense power, this role often requires elevation (a temporary assignment of the role) even for users who normally hold the `admin` role. This adds an extra layer of security, preventing accidental or malicious changes to fundamental security settings.

17. What is impersonation?

Answer: Impersonation in ServiceNow is the act of logging in as another user for testing and troubleshooting purposes. An administrator (or any user with the `impersonator` role) can temporarily switch their current session to that of another user, effectively experiencing the ServiceNow instance exactly as that user would. This means they see the same forms, lists, modules, and data access restrictions as the impersonated user.

Use Cases: It’s invaluable for debugging access issues, validating UI customizations, testing workflows from an end-user perspective, or replicating reported user problems.

Troubleshooting Tip: Always remember to end your impersonation session using the “End Impersonation” option in the user menu to return to your own user context. Accidentally performing actions as an impersonated user can lead to confusion and incorrect data entries.

18. What is user preference?

Answer: User preferences in ServiceNow allow individual users to customize certain aspects of their personal interface and experience within the platform. These preferences are stored on a per-user basis and only impact that specific user; they do not affect the entire instance or other users globally. Examples include setting a preferred time zone, choosing a default dashboard, adjusting notification settings, or even customizing list layouts.

Elaboration: User preferences enhance the personalized user experience without requiring global configuration changes, offering flexibility for individual work styles. They are stored in the sys_user_preference table.

ITSM Fundamentals: Incident, Problem, and Change Management

The core of ServiceNow’s value often lies in its IT Service Management (ITSM) capabilities. As a ServiceNow developer, you must understand the definitions, relationships, and lifecycle of Incident, Problem, and Change.

19. What is an Incident?

Answer: An incident represents an unplanned interruption to an IT service or a reduction in the quality of a service. It’s something that has stopped working, or is working incorrectly, and requires immediate attention to restore normal service operation as quickly as possible. The primary goal of incident management, following ITIL guidelines, is to restore service rapidly and minimize business impact.

Real-world Example: “My laptop isn’t connecting to Wi-Fi,” “The company email system is down,” or “I can’t access the project management tool.”

20. What is a Problem?

Answer: A problem is the underlying cause of one or more incidents. It’s not the incident itself, but the root cause that, if resolved, would prevent future recurrences of related incidents. If the same issue is repeatedly happening to an employee, or if multiple people are experiencing the same incident, it strongly indicates a deeper, systemic problem. In such cases, a ‘Problem’ record is created, often linking to multiple ‘Incident’ records. ServiceNow even allows for the creation of a ‘parent incident’ with all similar recurring issues becoming ‘child incidents’ that roll up to it. Resolving the underlying problem (often by closing the Problem record) should lead to the closure of all associated incidents, signifying a lasting fix.

Real-world Example: If 50 employees report “My laptop isn’t connecting to Wi-Fi” after a recent network upgrade, the individual reports are incidents, but the underlying ‘Problem’ might be a misconfiguration in the new network hardware or software.

29. What is the relationship between Incident, Problem, and Change Management?

Answer: These three core ITSM processes are tightly integrated and often flow into one another:

  • Incident to Problem: A user faces an immediate issue and creates an Incident to restore service quickly. If that same issue (or similar ones) keeps happening, it signifies a deeper, recurring issue. This prompts the creation of a Problem record, linking to the incident(s), to investigate and identify the root cause.
  • Problem to Change: Once the root cause of a Problem is identified, if the resolution requires an alteration to an IT service, component, or process (e.g., applying a patch, updating firmware, reconfiguring a server), a Change Request is initiated from the Problem. This ensures that the modification is planned, tested, and implemented in a controlled manner to minimize risk and impact on services.
  • Change to Incident (and vice-versa): While Changes typically originate from Problems, a Change could also be created directly from an Incident if the incident’s resolution immediately requires a system modification. Conversely, a poorly executed Change can sometimes *cause* new Incidents.

In essence, Incidents are reactive (fix something broken), Problems are proactive or reactive to recurring issues (find the cause, prevent future breaks), and Changes are deliberate, controlled modifications (implement a planned improvement or fix).

21. Can we create a Problem record from an Incident?

Answer: Yes, absolutely. This is a very common and essential workflow in ITSM. If an incident’s investigation reveals that it’s a symptom of a deeper, recurring issue, a Problem record should be created directly from that incident. This links the two records, allowing for proper problem management (root cause analysis) and tracking of the underlying issue, ultimately aiming to prevent future incidents.

22. Can we create a Change Request from an Incident?

Answer: Yes. When handling an incident, if a support engineer determines that the resolution requires a modification to the system, software, or infrastructure (e.g., applying a patch, reconfiguring a server, or upgrading software), they will often create a Change Request directly from that incident. This ensures that the required modification is managed through the formal change management process, which includes planning, approval, testing, and implementation, minimizing risk to the service.

23. How to create an Incident record using script?

Answer: Creating records using GlideRecord is a core development skill. Here’s how you’d create an Incident:

var gr = new GlideRecord('incident'); // Instantiate GlideRecord for the Incident table
gr.initialize(); // Prepares a new, empty record
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94'; // Sys_id of the user reporting the incident
gr.category = 'inquiry'; // Category of the incident
gr.subcategory = 'antivirus'; // Subcategory (e.g., specific software issue)
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the Configuration Item (CI) affected
gr.short_description = 'Test incident created via server-side script'; // Brief summary
gr.description = 'This incident was automatically generated by a server-side script for testing purposes.'; // Detailed description
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the group to which the incident is assigned
gr.insert(); // Inserts the new record into the database

if (gr.sys_id) {
    gs.info("Incident " + gr.number + " created successfully!");
} else {
    gs.error("Failed to create incident via script.");
}

24. How to create a Problem record using script?

Answer: The pattern for creating a Problem record is very similar to an Incident, simply targeting the `problem` table:

var gr = new GlideRecord('problem'); // Instantiate GlideRecord for the Problem table
gr.initialize();
gr.caller_id = '86826bf03710200044e0bfc8bcbe5d94'; // Sys_id of the user who identified/reported the problem
gr.category = 'inquiry';
gr.subcategory = 'antivirus';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the CI associated with the problem
gr.short_description = 'Test problem created via script - Recurring antivirus issue';
gr.description = 'Root cause analysis is needed for a pattern of recurring antivirus-related incidents.';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the problem management group
gr.insert();

if (gr.sys_id) {
    gs.info("Problem " + gr.number + " created successfully!");
} else {
    gs.error("Failed to create problem via script.");
}

25. How to create a Change Request using script?

Answer: Creating a Change Request also follows the same GlideRecord pattern, but remember that Change Requests often have specific types (Normal, Standard, Emergency) and more structured fields related to planning and risk.

var gr = new GlideRecord('change_request'); // Instantiate GlideRecord for the Change Request table
gr.initialize();
gr.type = 'normal'; // Specify the type of change (e.g., 'normal', 'standard', 'emergency')
gr.category = 'software';
gr.subcategory = 'patching';
gr.cmdb_ci = 'affd3c8437201000deeabfc8bcbe5dc3'; // Sys_id of the CI that will be modified by the change
gr.short_description = 'Test change request for antivirus software update';
gr.description = 'Implement the latest antivirus definitions and client software across all workstations.';
gr.assignment_group = 'a715cd759f2002002920bde8132e7018'; // Sys_id of the group responsible for implementing the change
gr.insert();

if (gr.sys_id) {
    gs.info("Change Request " + gr.number + " created successfully!");
} else {
    gs.error("Failed to create change request via script.");
}

Elaboration on Scripting: In all these examples, notice the consistent pattern of using GlideRecord. You instantiate it with the table name, call initialize() for a new record, set field values (using sys_ids for reference fields), and then insert(). This pattern is fundamental to server-side record manipulation and automation in ServiceNow.

Advanced ITSM Logic: Business Rules & Workflow Automation

These questions delve into your ability to implement custom business logic and automate processes within ServiceNow, often using Business Rules, which are critical for platform customization.

26. Write a logic for whenever a parent incident is closed, all child incidents should also be closed.

Answer: This is a perfect use case for an After Business Rule because you want the parent incident to be successfully closed and saved *before* you act on its children.

Configuration for the Business Rule:

  • Table: Incident [incident]
  • When: After
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) && current.parent.nil() (Assuming ‘7’ is the `sys_choice` value for ‘Closed’. The `current.parent.nil()` check ensures this rule only fires if the *current* incident is a top-level parent, preventing unintended cascades from child to grandchild incidents).

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the current incident is being closed AND it is a top-level parent incident
    if (current.state == 7 && current.parent.nil()) {
        var grChild = new GlideRecord('incident');
        grChild.addQuery('parent', current.sys_id); // Find all child incidents linked to this parent
        grChild.addQuery('state', '!=', 7); // Only close children that are not already closed
        grChild.query();

        while (grChild.next()) {
            grChild.state = 7; // Set the state of the child incident to Closed
            grChild.active = false; // Deactivate the child incident
            grChild.comments = "Closed automatically as parent incident " + current.number + " was closed."; // Add a comment for context
            grChild.update(); // Update the child incident record
        }
    }
})(current, previous);

Elaboration: This script demonstrates querying for related records and updating them. The `After` Business Rule ensures the parent incident’s closure is committed before acting on its children. The `current.parent.nil()` check is vital to prevent unintended recursive loops or incorrect behavior in complex incident hierarchies. Always consider state values (like ‘7’ for Closed) and ensure they match your instance’s configuration.

27. There is an incident and that incident has associated 2 tasks. When you try to close that incident, if any incident task is open, the employee should not be able to close the incident. Similarly for problem, and change request.

Answer: This scenario requires a Before Business Rule to prevent the action *before* the database transaction commits the closure.

Configuration for the Business Rule:

  • Table: Incident [incident]
  • When: Before
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) (This ensures the rule only runs when someone attempts to set the incident’s state to ‘Closed’).

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the incident is being closed
    if (current.state == 7) {
        var grTask = new GlideRecord('incident_task');
        grTask.addQuery('incident', current.sys_id); // Find tasks related to this incident
        grTask.addQuery('active', true); // Check for active (open) tasks
        // Alternatively, or additionally: grTask.addQuery('state', '!=', 3);
        // Assuming '3' is the sys_choice value for 'Closed' state in incident_task
        grTask.query();

        if (grTask.hasNext()) { // If any active incident tasks are found
            gs.addErrorMessage('Cannot close Incident ' + current.number + ' because there are still open associated tasks. Please close all tasks first.');
            current.setAbortAction(true); // Prevents the incident from being saved (closed)
        }
    }
})(current, previous);

Elaboration: The key here is current.setAbortAction(true);, which halts the database transaction and prevents the record from being saved in its new (closed) state. Using a `Before` Business Rule is critical because you want to prevent the closure *before* it’s committed to the database. This logic can be easily adapted for Problem (`problem_task` table) and Change Request (`change_task` table) by changing the target table in the GlideRecord query.

28. Whenever a problem is closed, the associated incident will also get closed.

Answer: This is another scenario ideal for an After Business Rule, acting on the `problem` table.

Configuration for the Business Rule:

  • Table: Problem [problem]
  • When: After
  • Update: Checked (true)
  • Condition: current.state.changesTo(7) (assuming ‘7’ is the `sys_choice` value for ‘Closed’ in the Problem table).

Script:

(function executeRule(current, previous /*null when async*/) {
    // Check if the problem record is being closed
    if (current.state == 7) {
        var grIncident = new GlideRecord('incident');
        grIncident.addQuery('problem_id', current.sys_id); // Find all incidents linked to this problem
        grIncident.addQuery('state', '!=', 7); // Only close incidents that are not already closed
        grIncident.query();

        while (grIncident.next()) {
            grIncident.state = 7; // Set the state of the incident to Closed
            grIncident.active = false; // Deactivate the incident
            grIncident.close_notes = "Closed automatically as associated problem " + current.number + " was closed."; // Add closure notes
            grIncident.update(); // Update the incident record
        }
    }
})(current, previous);

Elaboration: This follows a similar pattern to closing child incidents. It iterates through associated incidents (linked by the `problem_id` field) and updates their state to ‘Closed’. It’s important to include a condition to only update incidents that aren’t already closed, to avoid unnecessary updates and potential business rule loops.

Table Structure & Data Modeling

A good ServiceNow developer understands the platform’s data model and how tables relate to each other. This knowledge is crucial for efficient data management, reporting, and customization.

30. Give me some names of out-of-the-box tables?

Answer: Out-of-the-box (OOB) tables are those that come pre-built with ServiceNow and are not custom creations. You can typically identify them because their names do not start with prefixes like x_ (for scoped applications) or u_ (for custom global tables). Common examples include:

  • incident
  • problem
  • change_request
  • sys_user
  • sys_user_group
  • cmdb_ci (Configuration Item)
  • task (the base task table)
  • sys_app (Applications)

31. What are some of the base tables?

Answer: Base tables are fundamental tables in ServiceNow that do not extend any other table themselves, but are extended by many other tables. They form the foundation of logical data models and provide common functionalities and fields. The two most prominent base tables are:

  • task: The base for all record-driven work, including Incidents, Problems, Changes, Service Catalog Requests, etc.
  • cmdb_ci: The base for all Configuration Items in the Configuration Management Database.

32. Give me some examples of task tables?

Answer: Task tables are any tables that extend the base task table. This inheritance provides them with common fields (like `number`, `short_description`, `state`, `assignment_group`) and functionalities (like work notes, comments, SLAs). Examples include:

  • incident
  • problem
  • change_request
  • sc_req_item (Requested Item)
  • sc_task (Service Catalog Task)
  • kb_submission (Knowledge Submission)

35. What happens when you extend a table?

Answer: When you extend a table in ServiceNow, the child table inherits all fields, Access Control Lists (ACLs), Business Rules, and Client Scripts from its parent table. This is a core concept of the platform’s architecture, leveraging object-oriented principles. Here’s what specifically happens:

  • Field Inheritance: The child table does not duplicate the parent’s fields physically. Instead, it effectively points to the parent’s field definitions. This means system fields (like `sys_id`, `sys_created_on`, `sys_updated_by`) are not re-created in the child table; they are accessed from the parent table record.
  • sys_class_name Field: A field called sys_class_name (often displayed as ‘Class’) is automatically added to the *parent* table. This field stores the name of the most specific table in the hierarchy for that record (e.g., if you view a record on the `task` table, its `sys_class_name` might be ‘incident’, ‘problem’, or ‘change_request’). Even if a table is extended by many others, it will only have one `sys_class_name` field.
  • Polymorphism: This architecture allows for polymorphism. A GlideRecord query on the parent table (e.g., `task`) can return records from any of its child tables (e.g., Incident, Problem), and you can still access fields specific to the child table if the `sys_class_name` matches.
  • Database Storage: A record in a child table (e.g., Incident) is physically stored across both the child table’s database table and the parent table’s database table, with the `sys_id` acting as the common identifier.

44. All tables will be stored where?

Answer: All table definitions, or metadata about the tables (including their names, parent tables, extensions, and basic properties), are stored in the sys_db_object table. This table is essentially ServiceNow’s schema definition for all tables within the instance.

37. What is the difference between temporary and normal table?

Answer:

  • Normal Tables: These tables are designed to store data permanently within the ServiceNow database. Records remain in these tables indefinitely until they are explicitly deleted by a user or an automated process (like archive rules). Most custom tables and out-of-the-box tables (e.g., `incident`, `sys_user`, `cmdb_ci`) are normal tables.
  • Temporary Tables: These tables are specifically designed to store data for a limited, temporary period. They typically extend the `import_set_row` table, and their data is automatically purged after a predefined retention period (often 7 days by default). Temporary tables are commonly used for staging data during integrations (Import Sets use them) or for temporary processing where historical data persistence isn’t required.

38. Can we increase the retention period in the temporary table?

Answer: Yes, the default retention period for temporary tables (typically 7 days) can be increased. This is done by modifying or creating an associated archive rule that governs the data purging for that specific temporary table. You can usually find and manage these rules under “System Archiving” in the navigation filter. Adjusting these rules allows you to comply with specific data retention policies for temporary data if needed.

39. What is the difference between remote tables and normal tables?

Answer:

  • Normal Tables: As previously discussed, these tables store data directly within the ServiceNow instance’s underlying database. When you query a normal table, you’re accessing data that is physically present and managed by the ServiceNow instance itself.
  • Remote Tables (or Virtual Tables): These tables allow ServiceNow to display and interact with data that resides in an external database or system *in real-time*, without actually importing or storing that data within the ServiceNow instance. When you query a remote table, ServiceNow dynamically fetches the live data directly from the external source via a configured integration (e.g., JDBC, REST). This is particularly useful for integrating with systems where the data should always be accessed directly at its source, ensuring it’s always current and reducing data duplication.

40. What is a one-to-one and one-to-many table relationship in ServiceNow?

Answer: Understanding table relationships is key to effective data modeling:

  • One-to-Many Relationship: This is the most common type of relationship. One record in the “parent” table can be associated with multiple records in the “child” table, but each child record can only be associated with one parent. This is typically implemented using a Reference field on the child table that points to the parent.
    • Example: Users and Incidents. One user (sys_user) can submit multiple incidents (incident), but each incident typically has only one primary caller (`caller_id` reference field on incident).
    • Example: Departments and Users. One department can have many users, but a user usually belongs to only one department.
  • Many-to-Many Relationship: This occurs when multiple records in one table can be associated with multiple records in another table. These relationships cannot be directly modeled with a simple reference field. Instead, they require a separate “junction” or “relationship” table that links the two primary tables. This junction table typically contains two reference fields, each pointing to one of the primary tables.
    • Example: Incidents and Configuration Items (CIs). An incident can affect multiple CIs, and a CI can be involved in many incidents. This is often managed via the `task_ci` (or similar custom) junction table.
    • Example: Users and Roles. A user can have multiple roles, and a role can be assigned to multiple users. This is managed by the `sys_user_has_role` table.

Data Security: Access Control Lists (ACLs)

Security is paramount in any enterprise platform. ACLs are the gatekeepers of your data, defining who can access what and how.

33. Whenever we create a table, how many access controls will get created?

Answer: When you create a new table in ServiceNow, by default, four Access Control List (ACL) rules are automatically created for that table. These ACLs are for the fundamental CRUD operations: read, write, create, and delete.

Elaboration: This default creation happens because the “Create access controls” checkbox is checked by default when you define a new table. If you uncheck it, no default ACLs will be created, and you would need to manually configure them. These default ACLs typically grant access to users with the `admin` role and often the new table’s specific role (if one was generated). It’s crucial to review and refine these ACLs based on your application’s precise security requirements to ensure proper data governance.

Field Configuration & UI/Data Policies

Customizing forms, ensuring data integrity, and enhancing user experience are significant parts of a developer’s role. This section covers various ways to achieve these goals.

34. How to create a number field, like an Incident number?

Answer: To create an automatically incrementing number field, similar to how Incident numbers (e.g., INC0000001) are generated, you need to configure the table’s “Number” field properties. This is done by navigating to the table’s dictionary entry (often on the `sys_id` record for the table itself, or for a specific field designated for auto-numbering). In the “Controls” tab, you define:

  • Prefix: A static string that comes before the number (e.g., ‘INC’, ‘PRB’, ‘CHG’).
  • Number: The starting number for the sequence (e.g., ‘1000’).
  • Number of digits: The total length of the numeric portion, padded with leading zeros (e.g., ‘7’ for INC0000001).
  • Crucially, ensure the “Auto-number” checkbox is checked to enable this functionality.

36. Can you give me 10 field types?

Answer: Absolutely! ServiceNow offers a wide array of field types to store different kinds of data efficiently. Here are 10 common ones:

  1. String: For short to medium text entries (up to 4000 characters).
  2. Reference: Links a record in one table to a record in another table (e.g., Caller on an Incident references `sys_user`).
  3. List: Allows selection of multiple records from another table (stores a comma-separated list of sys_ids).
  4. Choice: A dropdown list of predefined options, chosen from a set of `sys_choice` records.
  5. Email: Stores an email address, with built-in format validation.
  6. Date/Time: Stores both a specific date and time.
  7. Date: Stores only a specific date.
  8. Boolean: A true/false or checkbox field.
  9. Integer: For whole numbers.
  10. Journal: A free-text field that logs entries with a timestamp and the user who made the entry (e.g., Work notes, Comments).
  11. Attachment: A pseudo-field type that enables file attachments to a record.
  12. Glide List: A specialized list field allowing multiple selections from a reference table.

41. In how many ways can we create a record in a ServiceNow table?

Answer: There are numerous ways to create records in ServiceNow, catering to various user interactions and integration scenarios:

  1. Through the Form: Manually via the standard UI form in the platform.
  2. Record Producer: Via a Service Catalog item, offering a user-friendly, abstracted interface to create records in backend tables.
  3. Inbound Email Actions: By parsing incoming emails to automatically create records (e.g., an Incident from a user’s email).
  4. GlideRecord Script: Programmatically using server-side JavaScript (as demonstrated in earlier examples) within Business Rules, Script Includes, etc.
  5. Import Sets (Excel/CSV/XML): Importing data from external files (like spreadsheets) into staging tables, then transforming it into target tables.
  6. Web Services/APIs: Through REST, SOAP, or other integrations from external systems pushing data into ServiceNow.
  7. Flow Designer / Workflow: As part of an automated process or flow, often triggered by other events.
  8. ServiceNow Studio / Script Background: For developers, directly creating records for testing or development purposes.

42. In how many ways can we make a field mandatory, read-only, or visible/hidden?

Answer: Fields can be controlled in various ways, each with its own scope and execution context:

  1. Dictionary Entry (Column Properties): The most fundamental and global way. Set ‘Mandatory’, ‘Read-only’, or ‘Active’ directly on the field’s dictionary record. This applies globally to all forms and lists for that table, unless specifically overridden.
  2. Dictionary Overrides: Used to change dictionary properties (like mandatory/read-only status or default values) for a specific field on a child table, overriding the parent table’s definition without affecting other children.
  3. UI Policies: Client-side logic that makes fields mandatory, read-only, or visible/hidden based on specific conditions on a form. They execute in the browser when the form loads or other fields change.
  4. Data Policies: Can enforce mandatory/read-only rules at both the client-side (UI) and server-side (all data entry points, including scripts, imports, web services). They ensure data integrity regardless of how the record is created or updated.
  5. Client Scripts (g_form API): Custom client-side JavaScript can dynamically control field properties (e.g., `g_form.setMandatory(‘field_name’, true)`, `g_form.setReadOnly(‘field_name’, true)`, `g_form.setVisible(‘field_name’, false)`). This offers the most flexibility for complex client-side logic but should be used sparingly where UI/Data Policies suffice.

Interview Tip: When discussing this, emphasize the hierarchy and best practices: Dictionary/Data Policy for universal data integrity, then UI Policy for UI-specific conditional logic, and Client Script only when other options aren’t sufficient or for very complex client-side interactions.

43. Can we make 2 fields as display in one table?

Answer: No, you should not set two fields as the “Display” field for a single table. While the platform might allow you to configure this in some edge cases or older versions, it will lead to confusion, inconsistent behavior, and potential issues in reference fields, lookup lists, auto-completion, and reporting. A table should have only one designated display field, which serves as the unique, primary human-readable identifier for records in that table (e.g., `name` for Groups, `short_description` for Incidents, `user_name` for Users).

45. How to set a default value on a field?

Answer: You can set a default value on a field so that it pre-populates whenever a new form for that table is opened. This significantly improves user efficiency and data consistency. This is primarily done within the field’s dictionary entry:

  • Default value field: For static values, you simply enter the desired string or number (e.g., ‘New’, ‘1’).
  • Default value calculation: For dynamic defaults, you can write a JavaScript expression. This script runs server-side when a new record form loads.
    • Example: `javascript:gs.getUserID()` to default a reference field to the current user’s sys_id.
    • Example: `javascript:new GlideDateTime().getDate()` to default a Date field to today’s date.
    • Example: `javascript:gs.getProperty(‘my_custom.default_group_sysid’)` to pull a default from a system property.

46. What is the current object?

Answer: The current object is a powerful, server-side GlideRecord object that represents the record being inserted, updated, or deleted by a Business Rule, Script Include, Workflow Script, or other server-side script. It’s essentially a temporary representation of the database record in memory during a transaction. It allows you to get (read) and set (write) the values of fields on that particular record as it’s being processed. It’s akin to interacting with the form’s fields, but on the server, before or after a database operation.

47. How to set the field values on the current form (server-side)?

Answer: When working with the `current` object (which is a server-side construct), you use its methods to manipulate field values:

  • current.setValue('field_name', value);: This method sets the internal, actual database value of a field. For reference fields, you *must* pass the `sys_id` of the referenced record as the `value`. This is the most direct way to set a value.
    current.setValue('caller_id', '62826bf03710200044e0bfc8bcbe5df1'); // Sets caller_id using the user's sys_id
  • current.setDisplayValue('field_name', value);: This method is specifically designed for reference fields. It allows you to set the value using the *display value* (e.g., the user’s name or a CI’s name) instead of its `sys_id`. ServiceNow will then automatically perform a lookup to resolve this display value to the correct `sys_id` behind the scenes. This is often more human-readable and convenient in scripts where you might have the display name but not the sys_id readily available.
    current.setDisplayValue('caller_id', 'John Doe'); // Sets caller_id using the user's display name

48. What are reference qualifiers, and their types? Explain each in detail, and what is the difference between simple and dynamic, dynamic and advanced, simple and advanced.

Answer: Reference Qualifiers are powerful tools used to restrict the data available for selection in Reference and List type fields on forms. They act as filters, ensuring users only see relevant and appropriate options, improving data quality and user experience.

3 Types of Reference Qualifiers:

  1. Simple Reference Qualifier:
    • Description: This is the most basic form of a reference qualifier. You define a fixed, static query string directly in the field’s dictionary entry to filter the referenced records. The conditions are unchanging and do not adapt based on other fields on the current form.
    • Example: If you have a “User” reference field and you only want to display active users, you’d set the simple reference qualifier as: active=true. For incidents, showing only “Open” incidents in a reference field: active=true^EQ (the `^EQ` is often automatically added by the system for simple queries).
    • Usage: Best suited for static, straightforward filtering needs where the criteria for selection never change based on the form’s context.
  2. Dynamic Reference Qualifier:
    • Description: This type leverages a pre-defined “Dynamic Filter Option” (created under System Definition > Dynamic Filter Options). These options encapsulate complex, often context-aware filtering logic that can adapt based on the current user, their groups, or other global system states. When you select a dynamic filter option, it generates a query at runtime.
    • Example: Displaying only Configuration Items (CIs) that are associated with the current user’s department, or only incidents “Assigned to my groups”. You’d create a dynamic filter option that captures this logic, then select that option in the reference field’s dictionary entry.
    • Usage: When the filtering logic is complex but reusable across multiple fields or tables, and can be encapsulated in a pre-built dynamic filter option without requiring full JavaScript code directly in the field.
  3. Advanced Reference Qualifier (JavaScript Reference Qualifier):
    • Description: This is the most powerful and flexible type. It uses custom JavaScript code to construct a query string dynamically. The script can access other fields on the current form (using `current.getValue(‘field_name’)` server-side, although `g_form` is client-side and generally not used for qualifiers directly), and other system data, to build a highly complex, conditional filter. The script must return a valid encoded query string.
    • Example: Filtering the “Assigned to” field to only show users who are members of the currently selected “Assignment Group” and who also have the ‘itil’ role.
      javascript: 'active=true^roles=itil^groupsIN' + current.assignment_group;

      (Note: `current` refers to the record on which the field exists, available server-side. For client-side context, you’d often use a Script Include called by the Advanced Qualifier.)

    • Usage: For highly complex, multi-condition, or context-sensitive filtering that cannot be achieved with simple or dynamic options. It provides maximum flexibility but also requires careful scripting and testing.

Differences between the types:

  • Simple vs. Dynamic: Simple is a fixed, static query. Dynamic uses a pre-built, potentially context-aware filter option, but the logic itself is predefined, not custom code per field.
  • Dynamic vs. Advanced: Dynamic relies on a predefined reusable filter option. Advanced gives you full, custom JavaScript control to construct the query string on the fly, offering the most flexibility for unique or very specific conditions.
  • Simple vs. Advanced: Simple is static, basic filtering. Advanced is dynamic, highly customizable, and script-driven, allowing for complex logic based on the form’s current state or other data.

49. What is a dependent value?

Answer: Dependent values in ServiceNow are a core feature used to create **cascaded dropdown menus**, where the available choices in one field (the dependent field) are filtered based on the selection made in another field (the parent field). This mechanism significantly improves data accuracy, guides users, and enhances the overall user experience by presenting only relevant options.

Steps to Configure Dependent Values:

Both the parent and dependent fields must be of type ‘Choice’.

  1. Identify Parent and Dependent Fields: For example, ‘Category’ could be the parent field, and ‘Subcategory’ would be the dependent field.
  2. Configure the Parent Field: Ensure the parent field has its list of possible choice values defined in its dictionary entry.
  3. Configure the Dependent Field:
    • Go to the dictionary entry of the dependent field (e.g., ‘Subcategory’).
    • In the “Dependent field” attribute (which is part of the “Advanced view” of the dictionary entry), select the parent field (e.g., ‘Category’).
    • Now, when you define the individual choices for the dependent field (e.g., ‘Subcategory’ choices like ‘Laptop’, ‘Desktop’, ‘Email’), you will see a “Dependent value” column. For each dependent choice, you must specify which parent category value it belongs to.

Example:

  • Parent Field: Category (Choices: Hardware, Software)
  • Dependent Field: Subcategory (Dependent on Category)
    • Subcategory Choice: Laptop (Dependent value: Hardware)
    • Subcategory Choice: Desktop (Dependent value: Hardware)
    • Subcategory Choice: Operating System (Dependent value: Software)
    • Subcategory Choice: Application (Dependent value: Software)

With this configuration, when a user selects “Hardware” in the Category field, only “Laptop” and “Desktop” will appear as options in the Subcategory field.

50. What is a calculated value?

Answer: A calculated value is a dictionary property that allows a field’s value to be automatically determined by a server-side script at the time of display or query, rather than being stored physically in the database. This script executes whenever the record is accessed, and it calculates the field’s value based on other field values on the current record (using the `current` object) or other related data.

Use Case: It’s useful for fields that are derived from other data but don’t need to be persistently stored, reducing database size and ensuring the value is always current. For example, a ‘Total Duration’ field on a task that calculates the difference between ‘Start Date’ and ‘End Date’ in real-time without storing the ‘Total Duration’ itself.

51. What are attributes? Name some of the attributes that you used?

Answer: Attributes are powerful key-value pairs that can be added to dictionary entries (fields or tables) to modify their behavior or appearance in various ways. They provide a flexible, low-code way to customize platform functionalities without writing extensive scripts. They essentially extend the core properties of fields or tables.

Some common attributes I’ve used include:

  • no_email=true: Prevents a field’s content from being included in email notifications.
  • no_attachment=true: Disables the ability to add file attachments to a form or specifically to a journal field.
  • no_add_me=true: For List fields, prevents the “Add Me” button from appearing, forcing users to search for entries.
  • tree_picker=true: Displays a reference field with a hierarchical tree picker for selection instead of the standard lookup list, useful for hierarchical data like CIs.
  • workflow=false: On a Choice field, this prevents changes to that field from triggering related workflows or Business Rules, useful for control fields that shouldn’t initiate business logic.
  • max_length=X: Specifies the maximum number of characters allowed for a String field (though this is also a standard dictionary definition).
  • reference_qual=active=true: An attribute that can be used for simple reference qualifiers.

52. What is a collection field on a table?

Answer: The ‘Collection’ dictionary entry is a special entry that exists for every table in ServiceNow. Unlike other dictionary entries that define specific fields on a table, the ‘Collection’ type entry represents the table itself. It’s automatically created when a new table is defined.

Use Case: Any attributes or properties (like ‘Read only’, ‘No attachment’, or certain client scripts) applied to this ‘Collection’ entry affect the entire table’s behavior globally, rather than just one specific field. For instance, if you want to prevent all attachments on a table, you’d add `no_attachment=true` to its ‘Collection’ dictionary entry.

53. How to enable/disable attachment on the form using attributes?

Answer: To control attachments for an entire table (and thus its forms), you would configure the ‘Collection’ dictionary entry for that table. Navigate to the table’s dictionary record (e.g., for ‘Incident’, find the dictionary record where Type is ‘Collection’). In the ‘Attributes’ field, you would:

  • To disable attachments: Add the attribute no_attachment=true.
  • To enable attachments (or re-enable if previously disabled): Remove the no_attachment attribute or set it to false (if it exists).

54. What are dictionary overrides? What are all the properties we can override in dictionary overrides?

Answer: A dictionary override is a powerful feature in ServiceNow that allows you to modify the behavior or properties of a field inherited from a parent table, specifically for a child table, without affecting other child tables or the parent itself. This is essential for tailoring forms and field behavior to the unique needs of different applications within a hierarchical table structure.

Properties you can override include:

  • Mandatory: Make a field mandatory or optional in the child table, even if its parent setting is different.
  • Read-only: Control whether a field is read-only or editable.
  • Default value: Set a different default for the field specifically for the child table.
  • Label: Change the display label of the field on the child table’s forms.
  • Hint: Provide a different tooltip or hint message.
  • Active: Make the field active (visible) or inactive (hidden) for the child table.
  • Reference qualifier: Apply a unique filter to a reference field’s lookup options.
  • Dependent field: Alter or establish dependency relationships for choice fields.
  • Display: (Generally discouraged for fields other than the standard display field) Change which field is considered the display value for a reference field.
  • Attributes: Add, remove, or modify specific attributes for the field within the child table context.

Real-world Example: The `priority` field on the base `task` table might have a default value of ‘4’ and be read-only for certain roles. However, for an `incident` (which extends `task`), you might want the default priority to be ‘3’ and allow `itil` users to write to it. A dictionary override on the `incident` table for the `priority` field would achieve this specific customization.

55. What are application menus?

Answer: Application Menus (often just called “Applications” in the left-hand navigation pane, or “Application Navigator”) are a fundamental UI component in ServiceNow. They act as logical containers for related functionalities, grouping together modules that users interact with. An Application Menu provides a high-level categorization of what a user can do within the platform.

Elaboration: For example, “Incident,” “Problem,” “Change,” “Service Catalog,” or “User Administration” are all Application Menus. Clicking on an Application Menu expands to show its associated “Modules.”

56. What is a process flow?

Answer: A process flow (also known as a ‘process formatter’ or ‘stage formatter’) is a visual indicator typically displayed at the top of forms in ServiceNow (e.g., Incident, Problem, Change, Request Item). It graphically represents the current state or stage of a record within its predefined lifecycle or workflow. Each stage in the flow illuminates as the record progresses.

Benefit: It provides users with a clear, at-a-glance understanding of where the record stands in a process, enhances user experience by guiding them through necessary steps, and quickly communicates progress or bottlenecks. It’s configured as a formatter on the form and driven by the state or stage field of the record.

57. What are data lookup rules?

Answer: Data lookup rules are a low-code configuration mechanism in ServiceNow used to automatically populate field values on a form based on the values of other fields, without requiring any scripting. They work by defining a “matcher” (a set of input fields whose values are compared) and a “setter” (a set of output fields whose values are populated) within a dedicated lookup table.

How it works: When the values in the matcher fields on a form change, the system consults the lookup table. If a row in the lookup table matches the current values of the matcher fields, the corresponding setter field values from that row are automatically populated onto the form.

Example: Based on the selected ‘Service’ and ‘Configuration Item’ (matcher fields), automatically set the ‘Assignment Group’ and ‘Priority’ (setter fields) for an Incident. This reduces manual data entry and ensures consistency.

58. What are UI Policies?

Answer: UI Policies are client-side logic that allow you to dynamically control the behavior of fields on a form, as well as the visibility of related lists, based on specific conditions. They execute directly in the browser, providing an immediate response to user actions or form loading. You can use UI Policies to:

  • Make fields mandatory.
  • Make fields read-only.
  • Make fields visible/hidden (control their ‘display’ property).
  • Show or hide related lists.

They are a powerful, low-code way to enhance user experience and guide data entry without necessarily writing JavaScript (unless advanced scripting is explicitly required).

59. What is the global checkbox in UI Policies?

Answer: The “Global” checkbox in a UI Policy determines its scope regarding form views.

  • When this box is checked, the UI Policy will apply to all views of the form on which it is configured. This means the policy will behave the same regardless of which view (e.g., “Default”, “Self Service”, “Workspace”) a user is using.
  • When the box is unchecked, the “View” field becomes active, allowing you to specify a particular view (or multiple views) for which that UI Policy will apply. In this case, the UI policy will only work on the specific view(s) you’ve selected.

This provides granular control over UI behavior across different user interfaces, allowing for tailored experiences.

60. What is ‘Reverse if false’ in UI Policies?

Answer: The “Reverse if false” checkbox is a critical setting in UI Policies.

  • If “Reverse if false” is selected, it means that when the UI Policy’s condition evaluates to `false`, the actions defined in the UI Policy will be reversed to their original state. For example, if a field was made mandatory when the condition was true, it will become optional again when the condition becomes false. If it was made hidden, it will become visible again.
  • If “Reverse if false” is not selected, the actions applied by the UI Policy (when the condition was true) will persist even if the condition later evaluates to false. They will not automatically revert.

Troubleshooting Tip: Not checking ‘Reverse if false’ is a common source of confusion in UI policies. It often leads to fields remaining in an undesired state (e.g., still read-only or hidden) even after the conditions that caused the change are no longer met, creating an inconsistent user experience.

61. What is the ‘On Load’ checkbox in UI Policies?

Answer: The “On Load” checkbox in a UI Policy controls when the policy’s conditions and actions are initially evaluated and applied:

  • When the “On Load” checkbox is selected, the UI Policy’s conditions are evaluated, and its actions are applied immediately when the form is initially loaded in the browser. This ensures the form starts in the correct state (fields mandatory, read-only, visible/hidden) based on the initial values of the fields.
  • If the “On Load” checkbox is not selected, the UI Policy’s actions will *not* be applied when the form is initially loaded. Instead, the actions will only be triggered when a specific field on the form is changed, and that change causes the UI Policy’s conditions to be met (or no longer met).

Typically, for policies that set initial states or make fields mandatory based on inherent record properties, ‘On Load’ is checked.

62. What is the ‘Inherit’ checkbox?

Answer: The “Inherit” checkbox in a UI Policy determines whether the policy’s rules apply to tables that extend the current table.

  • When this checkbox is selected, the same UI Policy will also be applied to all child tables that extend the table on which the UI Policy is defined. This is incredibly useful for maintaining consistent UI behavior across a hierarchy of tables (e.g., a UI Policy on the base `task` table can affect `incident`, `problem`, and `change_request`).
  • If the checkbox is not selected, the UI Policy will only apply to the specific table it’s configured on and not to any of its child tables.

63. Can you write a script in a UI Policy?

Answer: Yes, you absolutely can write client-side JavaScript within a UI Policy. To enable this, you need to check the “Run scripts” checkbox within the UI Policy record. Once checked, two script fields will appear: “Execute if true” and “Execute if false”.

You can then add custom JavaScript code that will execute when the UI Policy’s conditions are met (in “Execute if true”) or when they are not met (in “Execute if false”). This is typically used for more complex UI manipulations or client-side logic that cannot be achieved with the standard UI Policy Actions, such as:

  • Displaying a complex alert message.
  • Setting a field’s color or dynamic styling.
  • Interacting with other elements on the form beyond simple field properties.
  • Calling a Script Include via GlideAjax for more complex data fetching or processing.

64. Can we convert a UI Policy as a Data Policy?

Answer: Yes, ServiceNow provides a convenient feature to convert an existing UI Policy into a Data Policy. You can typically find a “Convert to Data Policy” or similar button/link when viewing a UI Policy record. This is a very useful shortcut when you’ve already defined UI rules (e.g., making a field mandatory conditionally) and realize those rules need to be enforced at a deeper, server-side level to ensure data integrity from all sources, not just the form UI.

65. Which are all the cases where a UI Policy cannot be converted as a Data Policy?

Answer: While converting a UI Policy to a Data Policy is often helpful, certain UI Policy actions are purely client-side (UI-specific) and cannot be translated into server-side Data Policy rules. A UI Policy cannot be fully converted into a Data Policy if it:

  • Controls data visibility: Data Policies focus on mandatory and read-only states for data integrity. They do not hide or show fields; that’s a client-side UI concern.
  • Controls form views: Data Policies are view-agnostic; they apply to all data access, not just specific UI views. UI Policies can be configured for specific views.
  • Controls related lists: Showing or hiding related lists is a purely client-side UI action and has no equivalent in server-side data enforcement.
  • Involves client-side scripting: Any custom client-side JavaScript within the UI Policy’s “Execute if true/false” sections cannot be directly converted into a Data Policy, as Data Policies don’t execute custom client scripts in the same way. While Data Policies can have server-side script options, this isn’t a direct “conversion” of client-side code.

66. What are Data Policies?

Answer: Data Policies are powerful rules in ServiceNow designed to enforce data integrity by making fields mandatory or read-only. Their key characteristic is that they enforce these rules at both the **client-side (UI)** and **server-side (all data sources)**. This means that unlike UI Policies (which only apply to forms), Data Policies apply regardless of how a record is created or updated – whether it’s via a form, an import set, a web service API, or a server-side script.

Purpose: Data Policies are critical for ensuring data consistency, quality, and adherence to business rules and regulatory compliance across the entire platform. They prevent inconsistent data entry, regardless of the entry point.

Key Difference from UI Policies: Data Policies are about enforcing *data integrity* at a fundamental level (client and server), ensuring the data itself conforms to rules. UI Policies are about enhancing the *user experience* on forms (client-side only), guiding users and dynamically changing the UI. Where possible, Data Policies are generally preferred for mandatory/read-only enforcement because of their broader scope.

Conclusion: Ready to Shine!

Phew! That was quite a journey through the heart of ServiceNow development. If you’ve absorbed these questions and their detailed explanations, you’re well on your way to acing your next ServiceNow developer interview. Remember, it’s not just about memorizing answers; it’s about truly understanding the underlying concepts, the ‘why’ behind the ‘what’, and how these features are applied in real-world scenarios to solve business problems.

The ServiceNow platform is vast and constantly evolving. Continuous learning, hands-on experience in a personal developer instance, and keeping up with the latest releases (like Washington D.C.!) are your best friends in this journey. Good luck with your interviews, practice your GlideRecord, brush up on your ITIL basics, and go build amazing things on ServiceNow!


Scroll to Top