pencils ready ✎

ServiceNow MCQs multiple-choice questions with answers & explanations

All 20 ServiceNow quiz questions on one page. Pick an answer in your head, then open Show answer to check it and read why. Want a score and a timer? Take them as a quiz instead.

  1. 1.

    In a before update business rule you set current.u_escalated = true. How is that change saved?

    easy
    1. AYou must call current.update()
    2. BIt is saved automatically with the record
    3. CYou must call current.insert()
    4. DCall setWorkflow(false) then update()
    Show answer

    Answer: B (It is saved automatically with the record)

    Changes made to current in before rules are written as part of the same database operation once all before rules finish. Calling current.update() triggers the business rules again and risks recursion; the docs say it is never necessary.

  2. 2.

    What is the value of previous inside an async business rule?

    mid
    1. AThe record as it was before this update ran
    2. BA copy of current holding the same values
    3. CThe last version stored in the audit history
    4. Dnull, as it runs after the transaction
    Show answer

    Answer: D (null, as it runs after the transaction)

    Async rules run later as a scheduled job, after the original transaction has finished, so previous is not available (the template says previous /*null when async*/). That is also why changes(), changesTo() and changesFrom() do not work in an async script, although they still work in the rule's condition.

  3. 3.

    Which client script type runs when a user changes a value using list editing?

    easy
    1. AonChange
    2. BonLoad
    3. ConCellEdit
    4. DonSubmit
    Show answer

    Answer: C (onCellEdit)

    Apart from onCellEdit, client scripts (and UI policies) apply only to forms. onCellEdit receives the edited sys_ids, table, old values, new value and a callback; passing false to the callback stops the change.

  4. 4.

    How does an onSubmit client script stop the form from being submitted?

    easy
    1. AReturn false from the function
    2. BCall g_form.abort()
    3. CCall current.setAbortAction(true)
    4. DSet g_scratchpad.cancel = true
    Show answer

    Answer: A (Return false from the function)

    Returning false from onSubmit cancels the submission. current.setAbortAction(true) is a server-side method used in before business rules, and g_form.abort() is not a GlideForm method.

  5. 5.

    For read access to the Number field on Incident (which extends Task), which field ACL is checked first?

    mid
    1. Atask.number
    2. B*.number
    3. Cincident.*
    4. Dincident.number
    Show answer

    Answer: D (incident.number)

    Field ACLs are matched from most specific to most general: incident.number, then task.number, then *.number, then incident.*, task.* and *.*. The user must also pass the table-level ACL.

  6. 6.

    A user has the admin role but not itil. What does g_user.hasRole('itil') return in their browser?

    mid
    1. Afalse
    2. Btrue
    3. Cundefined
    4. DIt throws an error
    Show answer

    Answer: B (true)

    hasRole() returns true if the user has the specified role or the admin role. Use g_user.hasRoleExactly('itil') if admins should not match.

  7. 7.

    Which GlideAjax method is synchronous, blocks the browser and is not available in scoped applications?

    mid
    1. AgetXML()
    2. BgetXMLAnswer()
    3. CgetXMLWait()
    4. DaddParam()
    Show answer

    Answer: C (getXMLWait())

    getXMLWait() waits for the server response and freezes the session meanwhile; the docs recommend getXML() or getXMLAnswer() with a callback instead. addParam() just adds a request parameter such as sysparm_name.

  8. 8.

    In a GlideAjax call, which parameter tells the script include which method to run?

    easy
    var ga = new GlideAjax('UserUtilsAjax');
    ga.addParam('???', 'getDepartment');
    ga.addParam('sysparm_user', g_form.getValue('caller_id'));
    ga.getXMLAnswer(function (answer) { g_form.setValue('u_department', answer); });
    1. Asysparm_name
    2. Bsysparm_method
    3. Csysparm_function
    4. Dsysparm_action
    Show answer

    Answer: A (sysparm_name)

    GlideAjax uses sysparm_name to pick the function in the client-callable script include; your own parameters must also start with sysparm_. sysparm_function is one of the reserved names the docs tell you to avoid.

  9. 9.

    Three P1 incidents match this query. What is logged?

    hard
    var ids = [];
    var gr = new GlideRecord('incident');
    gr.addQuery('priority', 1);
    gr.query();
    while (gr.next()) {
      ids.push(gr.sys_id);
    }
    gs.info(ids.join(','));
    1. AThree different sys_ids
    2. BThree empty strings
    3. CThe same sys_id repeated three times
    4. DA TypeError, since sys_id is not a string
    Show answer

    Answer: C (The same sys_id repeated three times)

    gr.sys_id is a GlideElement object that the GlideRecord reuses as next() advances, so the array holds three references to the same element. Push a string instead: gr.getValue('sys_id'), gr.getUniqueValue() or gr.sys_id.toString().

  10. 10.

    For an active incident, what does gr.getValue('active') return?

    hard
    1. AThe boolean true
    2. BThe string "true"
    3. CThe number 1
    4. DThe string "1"
    Show answer

    Answer: D (The string "1")

    getValue() always returns a string (or null when the field is empty), and boolean fields come back as "1" or "0". So if (gr.getValue('active') == true) is a subtle bug; compare with "1" or use gr.active == true.

  11. 11.

    An encoded query passed to addEncodedQuery() contains a misspelled field name. By default, what happens when it runs?

    hard
    1. AAn exception is thrown and nothing runs
    2. BThe query safely returns no records at all
    3. CInvalid part dropped; may return all rows
    4. DOnly the first valid condition is applied
    Show answer

    Answer: C (Invalid part dropped; may return all rows)

    The docs warn that the invalid part of the condition is dropped and results are based on the remaining valid part, which can return every record, dangerous before an update() or deleteMultiple(). The glide.invalid_query.returns_no_rows property changes this to return no rows.

  12. 12.

    You only need the number of active incidents, not the records. Which approach does the documentation recommend?

    mid
    1. AGlideRecord query() then getRowCount()
    2. BGlideAggregate with addAggregate('COUNT')
    3. CLoop with next() and increment a counter
    4. DGlideRecord with setLimit(1) and getRowCount()
    Show answer

    Answer: B (GlideAggregate with addAggregate('COUNT'))

    getRowCount() runs a normal query that retrieves the matching records; GlideAggregate asks the database for just the count, which is much more efficient. Note that setLimit(1) would also cap the count at one.

  13. 13.

    Records created through the REST Table API arrive without a required field. What enforces the field as mandatory for all data sources?

    mid
    1. AA UI policy
    2. BAn onSubmit client script
    3. CA data policy
    4. DA catalog UI policy
    Show answer

    Answer: C (A data policy)

    UI policies and client scripts only run on forms in the browser. Data policies are enforced server-side on GlideRecord operations, including the Table API, Scripted REST APIs and import sets (unless opted out).

  14. 14.

    A transform map has no coalesce fields. What happens when the same file is imported twice?

    easy
    1. AExisting records are updated in place
    2. BThe second import is rejected as a duplicate
    3. CEvery row is inserted again as a new record
    4. DRows update the first record that matches
    Show answer

    Answer: C (Every row is inserted again as a new record)

    Without coalesce, all imported rows are treated as new records, so a re-import creates duplicates. Mark a genuinely unique field (such as email or employee number) as coalesce so matches are updated instead.

  15. 15.

    Which change type is pre-authorized, low risk and repeatable, and skips CAB authorization?

    easy
    1. AStandard change
    2. BNormal change
    3. CEmergency change
    4. DUnauthorized change
    Show answer

    Answer: A (Standard change)

    Standard changes come from pre-approved templates and move from New straight to Scheduled. Normal changes need assessment and CAB authorization; emergency changes skip Assess but still need authorization from the CAB approval group.

  16. 16.

    Which of these is not captured in an update set by default?

    easy
    1. AA new business rule on Incident
    2. BA change to the Incident form layout
    3. CA new ACL on a custom table
    4. DA new incident record created in dev
    Show answer

    Answer: D (A new incident record created in dev)

    Update sets capture configuration (business rules, ACLs, forms, dictionary and so on) but not task or process data such as incidents. Move data with XML export/import or import sets.

  17. 17.

    Two notifications on Incident fire for the same record and the same recipient, with weights 10 and 20. What happens?

    mid
    1. ABoth emails are sent
    2. BOnly the weight 20 notification is sent
    3. COnly the weight 10 notification is sent
    4. DNeither is sent because they conflict
    Show answer

    Answer: B (Only the weight 20 notification is sent)

    When notifications are duplicates for the same table and recipients, only the one with the highest weight is sent and the others move to the Skipped mailbox. A weight of 0 means the notification is always sent.

  18. 18.

    What is the main purpose of a display business rule?

    easy
    1. AValidate fields just before the record is saved
    2. BSend server data to the form via g_scratchpad
    3. CHide rows from lists before the query executes
    4. DRun heavy processing after the form is submitted
    Show answer

    Answer: B (Send server data to the form via g_scratchpad)

    Display rules run when a form is requested, after the record is read and before it is sent to the browser. Their main job is to fill g_scratchpad, avoiding extra GlideAjax round trips. Validation is a before rule, row filtering is a before query rule, and heavy work belongs in async rules.

  19. 19.

    A before business rule must read the assignment group that an assignment rule sets during the same save. Which Order value works?

    hard
    1. AOrder 100
    2. BOrder 999
    3. COrder 1000 or higher
    4. DAny order: engines run first
    Show answer

    Answer: C (Order 1000 or higher)

    The documented sequence is: before rules with order below 1000, then before engines (assignment rules, data lookup, approvals, data policy and others), then before rules with order 1000 or higher, then the database operation.

  20. 20.

    Which script can the Script Debugger pause at a breakpoint?

    hard
    1. AA business rule run by a user submitting a form
    2. BA scheduled job running in the background
    3. CAn async business rule processed by the scheduler
    4. DA client script running in the browser
    Show answer

    Answer: A (A business rule run by a user submitting a form)

    The Script Debugger pauses server-side scripts in interactive transactions, where gs.isInteractive() is true, such as form submits and UI actions. Background work like scheduled jobs and async rules is non-interactive, and client scripts are debugged with browser developer tools.

esc