SNOW-CAD Practice Question: Automating application logic with business rules and scripts
A large financial institution has a custom application for managing trade requests. The application uses a business rule on the 'Trade' table that calculates and sets the 'net_value' field based on 'quantity' and 'price'. Recently, traders have reported that when they update existing trades via a REST API integration, the 'net_value' field is not being recalculated. The business rule is set to run 'before' insert and 'before' update. The REST API uses GlideRecord to update the trade records. Upon investigation, the developer finds that the business rule script includes a check: 'if (current.changes('quantity') || current.changes('price')) { // recalculate }'. The script works correctly when updates are made from the UI. What is the most likely cause of the issue?
⚠ Common exam trap
It's easy for candidates to assume `changes()` works universally in all update contexts, but ServiceNow specifically designed it to rely on the `previous` object, which is not populated in scripted REST API GlideRecord updates unless the record is explicitly loaded with `get()` before modification.
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
✓
The GlideRecord used in the REST API does not load the record's previous values, so changes() returns false.
The GlideRecord API used in REST API integrations does not automatically load the previous values of fields into the `changes()` method. When a record is updated via GlideRecord in a scripted REST API, the `current` object in the business rule does not have the 'previous' values populated, so `current.changes('quantity')` and `current.changes('price')` both return `false`. This causes the recalculation logic to be skipped, even though the business rule is set to run 'before update'. In contrast, UI updates load previous values correctly, making `changes()` work as expected.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The business rule is set to run 'before' update, but the REST API triggers 'after' update.
Why it's wrong here
REST API updates trigger 'before' and 'after' business rules based on the operation; 'before' should still run.
- ✓
The GlideRecord used in the REST API does not load the record's previous values, so changes() returns false.
Why this is correct
The changes() method relies on the previous values being loaded into the GlideRecord object. If the script creates a new GlideRecord and sets fields without first getting the record, or if the update is performed via a GlideRecord that hasn't been initialized with the old record, changes() may not detect changes.
- ✗
The REST API sends the update request to a different instance, bypassing the business rule.
Why it's wrong here
The REST API is calling the same instance; otherwise, the trade wouldn't be updated at all.
- ✗
The condition 'current.changes('quantity') || current.changes('price')' is incorrectly formatted; it should use 'current.changes('quantity') || current.changes('price')'.
Why it's wrong here
The syntax is correct; the issue is not with the condition itself.
Go deeper
Related to this question
About these practice questions
This SNOW-CAD question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.