Courseiva

SNOW-CAD Practice Question: Automating application logic with business rules and scripts

Exhibit

Refer to the exhibit.

Business Rule: 'Set Category on Insert'
Table: [incident]
When to run: Before insert
Condition: true
Script:
(function executeRule(current, previous /*null when async*/) {
    var cat = new GlideRecord('sys_choice');
    cat.addQuery('name', 'incident');
    cat.addQuery('element', 'category');
    cat.addQuery('value', current.correlation_id.toString());
    cat.query();
    if (cat.next()) {
        current.category = cat.value;
    }
})(current, previous);

The business rule above is intended to set the category of an incident based on the correlation_id. However, it is not working as expected. What is the most likely cause?

⚠ Common exam trap

ServiceNow often tests the misconception that all fields are populated at the time a 'before insert' business rule runs, when in fact only fields explicitly provided in the current operation are available.

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 business rule runs before insert, so the correlation_id field may not have a value yet.

Business rules that run 'before insert' execute before the record is saved to the database. At that point, the `correlation_id` field may not yet have a value if it is not provided by the user or set by another process. The script attempts to read `current.correlation_id` to determine the category, but if the field is empty, the condition fails and the category is never set.

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 script is trying to set a field that is read-only before insert.

    Why it's wrong here

    Category is writable before insert.

  • The business rule runs before insert, so the correlation_id field may not have a value yet.

    Why this is correct

    Before insert, the record is new; correlation_id might be empty if not provided.

  • The sys_choice table does not contain the choices for the incident category field.

    Why it's wrong here

    It does, choices are stored there.

  • The GlideRecord query is incorrectly using 'name' instead of 'table'.

    Why it's wrong here

    'name' is the correct field for table name in sys_choice.

About these practice questions

Courseiva writes every SNOW-CAD question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.