ServiceNow CAD Practice Test Questions and Exam Dumps Part12 Q221-240

View Full ServiceNow CAD Exam Dumps and Practice Test Dumps.

 

Question 221

Which ServiceNow API is used to retrieve the display value of a field?

  1. getValue()
  2. getDisplayValue()
  3. getLabel()
  4. getFieldValue()

Correct Answer: 2

Explanation

The getDisplayValue() method is used with GlideRecord to retrieve the human-readable display value of a field. This is especially useful for reference fields because the database may store a sys_id while the user sees a meaningful name. For example, a reference field may store a user’s unique identifier but display the user’s name. getValue() retrieves the underlying field value, while getDisplayValue() retrieves the value intended for display. Developers should understand the difference between these methods when working with reference fields, choice fields, and other data types where stored values and displayed values may differ.

Question 222

Which ServiceNow feature allows developers to create a custom button on a form that performs an action?

  1. UI Action
  2. UI Policy
  3. Business Rule
  4. Data Policy

Correct Answer: 1

Explanation

A UI Action can create buttons, links, or contextual actions on ServiceNow forms and lists. A UI Action can execute client-side or server-side logic depending on its configuration. For example, developers can create a button that changes a record’s state, creates a related record, or performs another custom operation. UI Policies control field behavior, Business Rules execute server-side logic based on database operations, and Data Policies enforce data requirements. UI Actions are therefore appropriate when the requirement involves giving users a visible control that triggers a specific operation.

Question 223

Which Business Rule type is executed when a record is displayed to a user?

  1. Before
  2. After
  3. Display
  4. Async

Correct Answer: 3

Explanation

A Display Business Rule runs when a record is loaded for display. It can be used to prepare server-side information that needs to be made available to client-side scripts through mechanisms such as the g_scratchpad object. Display Business Rules execute before the form is presented to the user. Before Business Rules run before a database operation, After Business Rules execute after the record is saved, and Async Business Rules process work asynchronously. Developers should use Display Business Rules carefully and only when server-side information is needed during form loading because unnecessary processing can increase form-load time.

Question 224

Which object is commonly used to access the current user’s roles in server-side scripting?

  1. GlideForm
  2. GlideUser
  3. GlideRecord
  4. GlideAggregate

Correct Answer: 2

Explanation

GlideUser provides functionality for working with information about the current user in ServiceNow. Depending on the scripting context, developers can use user-related methods to determine information such as roles, groups, or user identity. This can be useful when implementing business logic that depends on the current user’s context. GlideForm is primarily a client-side form API, GlideRecord is used for database operations, and GlideAggregate performs aggregate queries. However, role checks in server-side logic should complement, rather than replace, proper ACL configuration when the requirement involves enforcing data security.

Question 225

What is the main purpose of a Data Lookup?

  1. To automatically determine field values based on matching conditions
  2. To create database tables
  3. To execute scheduled scripts
  4. To define ACL permissions

Correct Answer: 1

Explanation

Data Lookup allows ServiceNow to automatically populate or determine field values based on predefined matching conditions. For example, a lookup can determine a value for one field based on another field or a combination of values. This reduces the need for users to manually enter information and can help standardize data. Data Lookup is different from a Transform Map, which is primarily used during data import processing. ACLs control security, Scheduled Script Executions run server-side scripts on a schedule, and tables define data structures. Proper lookup configuration can improve consistency and reduce repetitive user input.

Question 226

Which method is commonly used to check whether a GlideRecord query contains another record during iteration?

  1. query()
  2. next()
  3. insert()
  4. update()

Correct Answer: 2

Explanation

The next() method is used to move through the records returned by a GlideRecord query. It returns true when another record is available and positions the GlideRecord object on that record. A common pattern is while (gr.next()), which processes each returned record one at a time. The query() method executes the query but does not itself iterate through the results. insert() creates a new record, while update() saves modifications to an existing record. Understanding the distinction between query() and next() is essential for correctly processing database results in ServiceNow scripts.

Question 227

Which feature provides reusable server-side JavaScript logic that can be called by multiple application components?

  1. Script Include
  2. Form Layout
  3. Notification
  4. UI Policy

Correct Answer: 1

Explanation

A Script Include stores reusable server-side JavaScript logic. It can contain functions, classes, and methods that can be called from different server-side application components. This promotes code reuse and prevents developers from duplicating the same logic in multiple Business Rules or other scripts. Script Includes can also be configured for client-side access when appropriate, allowing GlideAjax to communicate with them. Form Layout controls field arrangement, Notifications send messages, and UI Policies control client-side field behavior. Centralizing reusable logic in Script Includes generally makes applications easier to maintain, test, and update.

Question 228

Which component is used to enforce security at the field level?

  1. UI Policy
  2. Client Script
  3. Field ACL
  4. Form Layout

Correct Answer: 3

Explanation

A field-level Access Control List, or field ACL, can control whether a user is allowed to perform operations such as reading or writing a particular field. Field ACLs are an important security mechanism because they enforce access at the platform level. UI Policies and Client Scripts can change how fields appear or behave on forms, but they should not be used as security controls because client-side logic can be bypassed. Form Layout only controls presentation. Developers should configure appropriate field-level ACLs whenever an application requires certain fields to be accessible only to authorized users or roles.

Question 229

Which ServiceNow component can be used to run JavaScript periodically without requiring a user to interact with the system?

  1. Client Script
  2. Scheduled Script Execution
  3. UI Action
  4. UI Policy

Correct Answer: 2

Explanation

Scheduled Script Executions allow server-side JavaScript to run according to a defined schedule. They can execute once or repeatedly at configured intervals and are useful for background processing, maintenance activities, data updates, and scheduled integrations. Client Scripts require a user interface interaction, while UI Actions are normally triggered by users and UI Policies control form behavior. Scheduled processing should be designed carefully because large database operations can consume system resources. Developers should also consider query efficiency and transaction volume when creating recurring scheduled scripts.

Question 230

Which ServiceNow feature is used to define fields, their data types, and other metadata?

  1. Dictionary
  2. Notification
  3. UI Action
  4. Flow Designer

Correct Answer: 1

Explanation

The Dictionary contains metadata that defines tables and fields within ServiceNow. Dictionary Entries can specify field types, lengths, default values, reference relationships, attributes, and other characteristics. Developers and administrators use dictionary configuration to define how data is structured and behaves at the field level. Notifications are used for communication, UI Actions create user-triggered controls, and Flow Designer is used for process automation. Understanding dictionary configuration is important because many platform behaviors depend on field metadata. Developers should make dictionary changes carefully because they can affect forms, lists, scripts, integrations, and existing data.

Question 231

Which API is commonly used to log informational messages from server-side scripts?

  1. g_form
  2. gs
  3. gr
  4. currentForm

Correct Answer: 2

Explanation

The gs object represents GlideSystem and provides various server-side system functions. Developers can use methods such as gs.info() to write informational messages to the system log during development and troubleshooting. GlideSystem also provides functionality related to users, properties, messages, dates, and other platform services. The g_form object is associated with GlideForm and is primarily used on the client side. gr is commonly used as a developer-created variable name for GlideRecord but is not a system API itself. Server-side logging can be valuable when debugging application logic and identifying unexpected execution behavior.

Question 232

Which feature is designed to automate business processes using a visual, low-code interface?

  1. Flow Designer
  2. Dictionary
  3. ACL
  4. Form Layout

Correct Answer: 1

Explanation

Flow Designer provides a visual, low-code environment for building automated business processes. Developers and administrators can use triggers, actions, conditions, subflows, and other components to automate tasks and processes. Flow Designer can integrate with ServiceNow applications and, where configured, external systems. Dictionary configuration defines field metadata, ACLs provide security, and Form Layout controls form presentation. Flow Designer is particularly useful when automation requirements can be implemented without extensive custom scripting. Custom actions and subflows can also extend its capabilities for more specialized application requirements.

Question 233

Which method can be used to remove a GlideRecord from the database?

  1. remove()
  2. deleteRecord()
  3. erase()
  4. deleteRow()

Correct Answer: 2

Explanation

The deleteRecord() method is used to delete the current record represented by a GlideRecord object. Before calling this method, developers should make sure that the GlideRecord points to the intended record. Deletion operations should be used carefully because removing records can affect related data and application processes. The methods remove(), erase(), and deleteRow() are not the standard GlideRecord method for deleting a record. In production applications, developers should consider whether records should actually be deleted or whether another approach, such as marking them inactive, is more appropriate.

Question 234

Which ServiceNow feature is used to define conditions and actions that control field behavior on forms?

  1. UI Policy
  2. REST Message
  3. Import Set
  4. Script Include

Correct Answer: 1

Explanation

UI Policies allow developers to define conditions that dynamically control field behavior on forms. They can make fields mandatory, visible, or read-only depending on the current form state. UI Policies provide a declarative alternative to custom JavaScript for many common client-side requirements. REST Messages are used for external integrations, Import Sets bring external data into ServiceNow, and Script Includes store reusable server-side logic. Developers should prefer UI Policies when they can satisfy a requirement without custom scripting because declarative configurations are generally easier to understand and maintain.

Question 235

Which statement about a reference field is correct?

  1. It stores a relationship to a record in another table
  2. It can only contain numeric values
  3. It is always a calculated field
  4. It cannot use qualifiers

Correct Answer: 1

Explanation

A reference field establishes a relationship between a record and a record in another ServiceNow table. Internally, the field generally stores the referenced record’s unique identifier, while the user interface displays the referenced record’s display value. Reference fields can also use Reference Qualifiers to restrict which records are available for selection. They are widely used to create relationships between users, groups, departments, companies, configuration items, and other records. Reference fields are not limited to numeric values and are not automatically calculated fields. Proper reference configuration helps maintain consistent relationships within an application’s data model.

Question 236

Which feature can be used to define reusable operations within Flow Designer?

  1. Custom Action
  2. Dictionary Entry
  3. ACL
  4. Form Section

Correct Answer: 1

Explanation

A Custom Action allows developers to create reusable operations for Flow Designer when the required functionality is not provided by an existing action. Custom Actions can define inputs, processing steps, and outputs that can be used within flows. They help organizations encapsulate specialized business logic while allowing process designers to use that functionality through the Flow Designer interface. Dictionary Entries define field metadata, ACLs control security, and Form Sections organize fields on forms. Custom Actions are useful for extending Flow Designer while keeping automation logic modular and reusable.

Question 237

Which API is used to make outbound REST calls from server-side ServiceNow scripts?

  1. GlideForm
  2. RESTMessageV2
  3. GlideUser
  4. GlideAggregate

Correct Answer: 2

Explanation

RESTMessageV2 is a server-side API used to make outbound REST calls from ServiceNow. Developers can use it to configure and send HTTP requests to external REST services, including setting endpoints, HTTP methods, headers, parameters, and authentication information. The response can then be processed by the ServiceNow script. GlideForm is used for client-side form operations, GlideUser provides user-related information, and GlideAggregate performs aggregate database queries. REST integrations should include appropriate authentication, error handling, timeout considerations, and response validation to ensure reliable communication with external systems.

Question 238

What is the purpose of an application scope in ServiceNow?

  1. To provide boundaries for application artifacts and control cross-scope access
  2. To automatically encrypt every field
  3. To prevent all users from accessing the application
  4. To replace ACLs

Correct Answer: 1

Explanation

Application scope provides boundaries around application components and helps control how applications interact with one another. Scoped applications can contain tables, scripts, modules, Business Rules, Script Includes, and other artifacts. When one application needs to access resources in another scope, cross-scope privileges or permissions may be required. Scope does not automatically encrypt fields, block all users, or replace ACLs. ACLs remain an important part of application security. Understanding scope is especially important when developing applications intended to coexist with other applications on the same ServiceNow instance.

Question 239

Which Client Script type executes when a user changes a specified field value?

  1. onSubmit
  2. onLoad
  3. onChange
  4. onDisplay

Correct Answer: 3

Explanation

An onChange Client Script executes when the value of a specified field changes. It is commonly used to dynamically modify other fields, display messages, validate information, or trigger client-side behavior based on a user’s selection. onLoad executes when the form initially opens, while onSubmit runs when the user attempts to save or submit the form. Selecting the correct Client Script type is important because each type has a different execution trigger. Developers should also ensure that onChange scripts do not perform unnecessary processing, especially on forms where users frequently modify fields.

Question 240

Which component is used to map source fields to target fields during an Import Set transformation?

  1. Business Rule
  2. Transform Map
  3. UI Action
  4. Script Include

Correct Answer: 2

Explanation

A Transform Map defines how data from an Import Set staging table is transferred and transformed into a target ServiceNow table. Field mappings specify which source fields correspond to which target fields. Transform Maps can also include scripts, coalesce configuration, and other transformation rules. Business Rules handle server-side record processing, UI Actions provide user interface controls, and Script Includes store reusable server-side logic. Transform Maps are essential when importing external data because they allow developers to control how incoming information is converted and stored in the target table while helping prevent incorrect mappings and duplicate records.