Courseiva

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

In a large enterprise environment, the ServiceNow instance is heavily customized. A business rule on the Change Request [change_request] table runs on after update to initiate a complex workflow involving multiple approvals and updates to Configuration Items (CIs). Recently, the IT operations team noticed that the workflow fails to start for many change requests. The system logs show the error: "Business rule script error: Cannot read property 'sys_id' of null". The developer inspects the business rule script and sees the following code snippet:

var task = new GlideRecord('task');

task.get(current.sys_id);

var relatedCI = task.cmdb_ci;

// The rest of the script uses relatedCI to update the CI's status. The developer knows that change requests are not stored in the task table; they are in change_request. However, the script was written by a previous developer and has been working for months. The developer must fix the script to ensure the workflow starts correctly. Which action should the developer take?

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

Use current.cmdb_ci directly

Best because current is already the change request record, so current.cmdb_ci is directly available. Option A would work but adds unnecessary database query. Option B would prevent the error but not fix the root cause; the script would still fail to get the CI if the record is not in task. Option D would hide the error but not fix the logic.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Wrap the script in a try-catch block and log the error then return

    Why it's wrong here

    This would hide the error and the workflow would still not start.

  • Change GlideRecord('task') to GlideRecord('change_request')

    Why it's wrong here

    This would work but is unnecessarily complex; current already holds the record.

  • Use current.cmdb_ci directly

    Why this is correct

    The current record is a change request, so current.cmdb_ci contains the CI.

  • Add a check if (task.isValidRecord()) before accessing cmdb_ci

    Why it's wrong here

    This would prevent the error but would not fix the logic; the CI would not be found.

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.