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.
Official reference: ServiceNow Developer
- 1.easy
In a before update business rule you set
current.u_escalated = true. How is that change saved?- AYou must call
current.update() - BIt is saved automatically with the record
- CYou must call
current.insert() - DCall
setWorkflow(false)thenupdate()
Show answer
Answer: B (It is saved automatically with the record)
Changes made to
currentin before rules are written as part of the same database operation once all before rules finish. Callingcurrent.update()triggers the business rules again and risks recursion; the docs say it is never necessary. - AYou must call
- 2.mid
What is the value of
previousinside an async business rule?- AThe record as it was before this update ran
- BA copy of
currentholding the same values - CThe last version stored in the audit history
- D
null, 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
previousis not available (the template saysprevious /*null when async*/). That is also whychanges(),changesTo()andchangesFrom()do not work in an async script, although they still work in the rule's condition. - 3.easy
Which client script type runs when a user changes a value using list editing?
- AonChange
- BonLoad
- ConCellEdit
- 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
falseto the callback stops the change. - 4.easy
How does an onSubmit client script stop the form from being submitted?
- AReturn
falsefrom the function - BCall
g_form.abort() - CCall
current.setAbortAction(true) - DSet
g_scratchpad.cancel = true
Show answer
Answer: A (Return
falsefrom the function)Returning
falsefrom onSubmit cancels the submission.current.setAbortAction(true)is a server-side method used in before business rules, andg_form.abort()is not a GlideForm method. - AReturn
- 5.mid
For read access to the Number field on Incident (which extends Task), which field ACL is checked first?
- A
task.number - B
*.number - C
incident.* - D
incident.number
Show answer
Answer: D (
incident.number)Field ACLs are matched from most specific to most general:
incident.number, thentask.number, then*.number, thenincident.*,task.*and*.*. The user must also pass the table-level ACL. - A
- 6.mid
A user has the
adminrole but notitil. What doesg_user.hasRole('itil')return in their browser?- A
false - B
true - C
undefined - DIt throws an error
Show answer
Answer: B (
true)hasRole()returns true if the user has the specified role or the admin role. Useg_user.hasRoleExactly('itil')if admins should not match. - A
- 7.mid
Which GlideAjax method is synchronous, blocks the browser and is not available in scoped applications?
- A
getXML() - B
getXMLAnswer() - C
getXMLWait() - D
addParam()
Show answer
Answer: C (
getXMLWait())getXMLWait()waits for the server response and freezes the session meanwhile; the docs recommendgetXML()orgetXMLAnswer()with a callback instead.addParam()just adds a request parameter such assysparm_name. - A
- 8.easy
In a GlideAjax call, which parameter tells the script include which method to run?
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); });- A
sysparm_name - B
sysparm_method - C
sysparm_function - D
sysparm_action
Show answer
Answer: A (
sysparm_name)GlideAjax uses
sysparm_nameto pick the function in the client-callable script include; your own parameters must also start withsysparm_.sysparm_functionis one of the reserved names the docs tell you to avoid. - A
- 9.hard
Three P1 incidents match this query. What is logged?
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(','));- AThree different sys_ids
- BThree empty strings
- CThe same sys_id repeated three times
- DA TypeError, since sys_id is not a string
Show answer
Answer: C (The same sys_id repeated three times)
gr.sys_idis a GlideElement object that the GlideRecord reuses asnext()advances, so the array holds three references to the same element. Push a string instead:gr.getValue('sys_id'),gr.getUniqueValue()orgr.sys_id.toString(). - 10.hard
For an active incident, what does
gr.getValue('active')return?- AThe boolean
true - BThe string
"true" - CThe number
1 - DThe string
"1"
Show answer
Answer: D (The string
"1")getValue()always returns a string (ornullwhen the field is empty), and boolean fields come back as"1"or"0". Soif (gr.getValue('active') == true)is a subtle bug; compare with"1"or usegr.active == true. - AThe boolean
- 11.hard
An encoded query passed to
addEncodedQuery()contains a misspelled field name. By default, what happens when it runs?- AAn exception is thrown and nothing runs
- BThe query safely returns no records at all
- CInvalid part dropped; may return all rows
- 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()ordeleteMultiple(). Theglide.invalid_query.returns_no_rowsproperty changes this to return no rows. - 12.mid
You only need the number of active incidents, not the records. Which approach does the documentation recommend?
- AGlideRecord
query()thengetRowCount() - BGlideAggregate with
addAggregate('COUNT') - CLoop with
next()and increment a counter - DGlideRecord with
setLimit(1)andgetRowCount()
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 thatsetLimit(1)would also cap the count at one. - AGlideRecord
- 13.mid
Records created through the REST Table API arrive without a required field. What enforces the field as mandatory for all data sources?
- AA UI policy
- BAn onSubmit client script
- CA data policy
- 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.easy
A transform map has no coalesce fields. What happens when the same file is imported twice?
- AExisting records are updated in place
- BThe second import is rejected as a duplicate
- CEvery row is inserted again as a new record
- 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.easy
Which change type is pre-authorized, low risk and repeatable, and skips CAB authorization?
- AStandard change
- BNormal change
- CEmergency change
- 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.easy
Which of these is not captured in an update set by default?
- AA new business rule on Incident
- BA change to the Incident form layout
- CA new ACL on a custom table
- 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.mid
Two notifications on Incident fire for the same record and the same recipient, with weights 10 and 20. What happens?
- ABoth emails are sent
- BOnly the weight 20 notification is sent
- COnly the weight 10 notification is sent
- 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.easy
What is the main purpose of a display business rule?
- AValidate fields just before the record is saved
- BSend server data to the form via
g_scratchpad - CHide rows from lists before the query executes
- 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.hard
A before business rule must read the assignment group that an assignment rule sets during the same save. Which Order value works?
- AOrder 100
- BOrder 999
- COrder 1000 or higher
- 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.hard
Which script can the Script Debugger pause at a breakpoint?
- AA business rule run by a user submitting a form
- BA scheduled job running in the background
- CAn async business rule processed by the scheduler
- 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.