- A
Use GlideAggregate to retrieve the count of matching groups
Why wrong: A count does not provide the assignment group needed.
- B
Store the mapping in a global script include variable that persists across sessions
Why wrong: Global variables are not suitable for this purpose and can cause memory issues.
- C
Create a script include with a static variable to cache the mapping for the duration of the current transaction
This caches the query results within the same request, reducing database calls.
- D
Move the business rule to run after insert so it does not block the insert
Why wrong: This would change the behavior because the assignment group would not be set before the record is saved.
Quick Answer
The correct answer is to create a script include with a static variable to cache the mapping for the duration of the current transaction. This technique directly addresses the need to improve business rule performance caching by ensuring that the GlideRecord query against the 5000-record u_group_mapping table runs only once per transaction, rather than on every incident insert. By storing the mapping data in a static variable, subsequent calls to the business rule within the same transaction reuse the cached results, drastically reducing database access overhead and preventing timeouts during peak hours. On the ServiceNow Certified Application Developer CAD exam, this scenario tests your understanding of transaction-scoped caching and script include best practices, often appearing as a trap where developers mistakenly consider database indexing or asynchronous business rules instead. A common memory tip is to think of the static variable as a “transactional sticky note”—it holds data only for the current script execution, not across sessions, making it ideal for repeated lookups without hitting the database again.
SNOW-CAD Practice Question: Automating application logic with business rules and scripts
This SNOW-CAD practice question tests your understanding of automating application logic with business rules and scripts. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A mid-sized company heavily relies on ServiceNow for incident management. They have a business rule that runs before insert on the Incident table. The rule dynamically sets the assignment group based on the category of the incident and the location of the caller. To determine the correct group, the script performs a GlideRecord query against a custom table called "u_group_mapping", which contains approximately 5000 records mapping category-location pairs to groups. During peak business hours, when many incidents are created simultaneously, the business rule causes significant delays and occasional timeouts, impacting user experience. The development team has been tasked with optimizing this business rule without changing its functionality. The current script structure is roughly: (function executeRule(current, previous) {
var gr = new GlideRecord('u_group_mapping');gr.addQuery('category', current.category); gr.addQuery('location', current.caller_id.location); gr.query();
if (gr.next()) {current.assignment_group = gr.assignment_group;
} })(current, previous);
The team wants to reduce the database access overhead. Which optimization technique should the developer implement?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
Create a script include with a static variable to cache the mapping for the duration of the current transaction
Option C is correct because caching the mapping data in a static variable within a script include ensures that the GlideRecord query against the 5000-record custom table is executed only once per transaction, rather than on every incident creation. This drastically reduces database access overhead during peak hours, as subsequent invocations of the business rule within the same transaction reuse the cached results, eliminating redundant queries and preventing timeouts.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use GlideAggregate to retrieve the count of matching groups
Why it's wrong here
A count does not provide the assignment group needed.
- ✗
Store the mapping in a global script include variable that persists across sessions
Why it's wrong here
Global variables are not suitable for this purpose and can cause memory issues.
- ✓
Create a script include with a static variable to cache the mapping for the duration of the current transaction
Why this is correct
This caches the query results within the same request, reducing database calls.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Move the business rule to run after insert so it does not block the insert
Why it's wrong here
This would change the behavior because the assignment group would not be set before the record is saved.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often confuse caching across sessions (Option B) with caching within a transaction (Option C), mistakenly thinking a global variable is more efficient, but ServiceNow’s architecture requires transaction-scoped caching to avoid stale data and concurrency conflicts.
Detailed technical explanation
How to think about this question
Under the hood, ServiceNow’s GlideRecord queries are synchronous and each invocation opens a new database connection, so caching the result set in a static variable (e.g., using a JavaScript object keyed by category-location pairs) avoids repeated round-trips to the database. A subtle behavior is that static variables in script includes are scoped to the current transaction (i.e., the same user session and request), so they are automatically cleared after the transaction completes, ensuring data freshness without manual invalidation. In a real-world scenario, this technique is critical for high-volume tables like Incident, where even a 50ms query per record can accumulate to seconds of delay during concurrent peak loads.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Automating application logic with business rules and scripts — study guide chapter
Learn the concepts, then practise the questions
- →
Automating application logic with business rules and scripts practice questions
Targeted practice on this topic area only
- →
All SNOW-CAD questions
500 questions across all exam domains
- →
ServiceNow Certified Application Developer CAD study guide
Full concept coverage aligned to exam objectives
- →
SNOW-CAD practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related SNOW-CAD practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Working with Data practice questions
Practise SNOW-CAD questions linked to Working with Data.
Platform Features and Integration practice questions
Practise SNOW-CAD questions linked to Platform Features and Integration.
Integrating and managing application data practice questions
Practise SNOW-CAD questions linked to Integrating and managing application data.
Automating application logic with business rules and scripts practice questions
Practise SNOW-CAD questions linked to Automating application logic with business rules and scripts.
Application development using ServiceNow Studio practice questions
Practise SNOW-CAD questions linked to Application development using ServiceNow Studio.
Creating and customizing tables and data practice questions
Practise SNOW-CAD questions linked to Creating and customizing tables and data.
Designing interfaces and user experiences practice questions
Practise SNOW-CAD questions linked to Designing interfaces and user experiences.
Core Application Development practice questions
Practise SNOW-CAD questions linked to Core Application Development.
User Interface Development practice questions
Practise SNOW-CAD questions linked to User Interface Development.
SNOW-CAD fundamentals practice questions
Practise SNOW-CAD questions linked to SNOW-CAD fundamentals.
SNOW-CAD scenario practice questions
Practise SNOW-CAD questions linked to SNOW-CAD scenario.
SNOW-CAD troubleshooting practice questions
Practise SNOW-CAD questions linked to SNOW-CAD troubleshooting.
Practice this exam
Start a free SNOW-CAD practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this SNOW-CAD question test?
Automating application logic with business rules and scripts — This question tests Automating application logic with business rules and scripts — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Create a script include with a static variable to cache the mapping for the duration of the current transaction — Option C is correct because caching the mapping data in a static variable within a script include ensures that the GlideRecord query against the 5000-record custom table is executed only once per transaction, rather than on every incident creation. This drastically reduces database access overhead during peak hours, as subsequent invocations of the business rule within the same transaction reuse the cached results, eliminating redundant queries and preventing timeouts.
What should I do if I get this SNOW-CAD question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 25, 2026
This SNOW-CAD practice question is part of Courseiva's free ServiceNow certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SNOW-CAD exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.