CSA - Data Migration and Integration (13% of the exam) - Section 6

Scripting in ServiceNow

Where scripting fits for an administrator: client scripts and their types (onLoad, onChange, onSubmit, onCellEdit), server-side scripting with GlideRecord basics, the JavaScript language of the platform, script includes, and the no-code alternatives to prefer before writing script.

Client scriptsGlideRecordScript includes

Practice question for this objective

Free sampleData Migration and Integrationmedium

An administrator has written a JavaScript function that three business rules on three different tables all need to call, and wants a single server-side definition rather than three copies. Which platform artefact is designed to hold that shared logic?

  • AA script include, which stores a reusable server-side class or function that server-side scripts across the instance can call Correct
  • BA UI script, which stores reusable JavaScript that the browser loads so that client-side code can call it
  • CA client script placed on each of the three tables, which keeps the shared logic beside the forms that depend on it
  • DA UI policy with a script action, which can run script on the form whenever the policy condition it carries is met
Identify the script include as the container for reusable server-side script that business rules and other server scripts call. Business rules run on the server, so shared code they call must also live on the server. A script include holds a named class or function that is loaded on demand when a server-side script references it, which gives one definition, one place to fix a defect, and no duplication across tables. UI scripts and client scripts are delivered to the browser and are unreachable from server-side execution.

Why A is correct: Correct: a script include is the platform's container for reusable server-side script, so all three business rules can instantiate it and call the one definition.

Why B is wrong: Tempting because a UI script genuinely is the reuse mechanism for shared JavaScript, but it is delivered to the browser and a server-side business rule cannot call it.

Why C is wrong: Tempting because it is the quickest thing to build, but it multiplies the code across three records and runs in the browser rather than on the server where the business rules execute.

Why D is wrong: Tempting because a UI policy can carry script, but that script is client-side form behaviour and a UI policy is not a container for reusable server-side functions.

See more CSA practice questions, answers explained.

Exam traps in Data Migration and Integration

Answers that look right on this material and are not. Each one is a distractor from a different question in the CSA bank for this domain.

  • Write an onChange client script on the Caller field that runs a GlideRecord query in the browser against the department table and reads the manager from the returned record.

    Why it is wrong: It is tempting because GlideRecord is the familiar way to read a record and the code looks the same as server script. Running it client side is unsupported in scoped applications and blocks the browser while it waits, so it is the wrong layer for a form lookup.

  • An onChange client script, because it fires whenever a field value is modified anywhere on the platform, list editing included

    Why it is wrong: Tempting because onChange is the type most administrators associate with a value being modified, but it is bound to a field on a form and does not run when a cell is edited from a list.

  • Call the update method, which commits the query and leaves the first matched record loaded in the object for reading

    Why it is wrong: Tempting because update is a familiar GlideRecord method, but it writes the current record back to the database and does nothing to move through query results.

Examworthy is not affiliated with or endorsed by ServiceNow. Original, blueprint-aligned practice material only.