Courseiva
Self-Service and AutomationmediumMultiple ChoiceObjective-mapped

SNOW-CSA Self-Service and Automation Practice Question

Exhibit

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested');
gr.addQuery('approval_for', gs.getUserID());
gr.query();
while(gr.next()){
    gr.state = 'approved';
    gr.update();
}

Refer to the exhibit. An administrator runs this script in a background script. What is the effect?

⚠ Common exam trap

ServiceNow often tests the distinction between 'all approvals' and 'approvals for the current user' to see if candidates notice the filter condition in the GlideRecord query.

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

It approves all pending approvals for the current user.

The script uses `GlideRecord` to query the `sysapproval_approver` table for records where `approver` equals the current user's sys_id and `state` is 'pending'. It then sets each record's `state` to 'approved' and updates it. This approves only the pending approvals assigned to the current user, not all approvals in the system.

Answer analysis

Option-by-option breakdown

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

  • It approves all approvals in the system.

    Why it's wrong here

    The script includes a filter for approval_for matching the current user, so it only affects that user's approvals.

  • It will cause an infinite loop.

    Why it's wrong here

    No update triggers are called that would re-trigger the script; it runs once.

  • It will fail because 'approval_for' is not a valid field.

    Why it's wrong here

    The 'approval_for' field is valid on the sysapproval_approver table.

  • It approves all pending approvals for the current user.

    Why this is correct

    The script targets only records where approval_for matches the current user and state is requested.

About these practice questions

Courseiva writes every SNOW-CSA question from scratch — 504 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-CSA 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-CSA exam.