Study Material/CAD/External Data
10% of Exam~6 questions

Working with External Data

This domain covers integrations: REST APIs (inbound and outbound), SOAP, Import Sets, web services, and Integration Hub. It tests your ability to connect ServiceNow with external systems.

Outbound REST (ServiceNow → External System)

Outbound REST integrations call external APIs FROM ServiceNow. They use REST Message records to define the endpoint, authentication, and request format.

REST Message Configuration

  • REST Message — Defines the base endpoint URL and authentication method.
  • HTTP Method — GET, POST, PUT, PATCH, DELETE (configured per method).
  • Authentication — Basic Auth, OAuth 2.0, Mutual Authentication, or No Auth.
  • Request Headers — Content-Type, Accept, custom headers.
  • Request Body — JSON/XML payload (for POST/PUT). Supports variable substitution.
  • Variable Substitution — Use ${variable_name} in URL and body. Replaced at runtime.

Calling REST Messages from Script

  • var sm = new sn_ws.RESTMessageV2('REST_Message_Name', 'HTTP_Method_Name');
  • sm.setStringParameterNoEscape('variable', value); — Set URL/body variables.
  • sm.setRequestBody(JSON.stringify(payload)); — Set custom body.
  • var response = sm.execute(); — Execute the call.
  • response.getStatusCode(); — HTTP status (200, 404, etc.).
  • response.getBody(); — Response body as string.
  • JSON.parse(response.getBody()); — Parse JSON response.
📝Exam Tip

Outbound REST uses RESTMessageV2. Know the pattern: create REST Message record → define HTTP methods → call from script with variable substitution. The exam tests both the configuration (no-code) and scripted approach. Always handle errors by checking getStatusCode() before parsing the body.

Inbound REST (External System → ServiceNow)

Inbound REST allows external systems to call ServiceNow. This includes the standard Table API and custom Scripted REST APIs.

Table API

  • URL: /api/now/table/{table_name}
  • GET — Read records (supports query parameters for filtering).
  • POST — Create a new record (JSON body with field values).
  • PUT — Replace a record entirely.
  • PATCH — Partial update (only specified fields).
  • DELETE — Delete a record by sys_id.
  • Controlled by ACLs — the authenticated user must have appropriate roles.

Scripted REST APIs

  • Custom endpoints with your own URL structure.
  • Define resources (URL paths) and HTTP methods.
  • Full control over request parsing and response formatting.
  • Access request data: request.body.data, request.queryParams, request.pathParams.
  • Set response: response.setStatus(200), response.setBody({...}).
  • Use for complex integrations where Table API is insufficient.
📝Exam Tip

Table API is for standard CRUD. Scripted REST APIs are for custom logic. Know when to use each. Scripted REST APIs give you full control over the endpoint path, request processing, and response format. Table API works out-of-the-box with no scripting.

Import Sets (Developer Perspective)

Developers use Import Sets for data migration and integration. Beyond the basic import/transform process, developers write Transform Scripts to handle complex data transformations.

Transform Scripts for Developers

  • onBefore(source, target, map, log) — Modify target values before insert/update. 'source' is the staging record, 'target' is the destination record.
  • onAfter(source, target, map, log) — Post-processing after each row. Create related records, send notifications.
  • Use ignore = true in onBefore to skip a row entirely.
  • Use error = true in onBefore to mark a row as failed.
  • source.u_field — Access staging table fields.
  • target.field — Access/set destination table fields.
📝Exam Tip

In transform scripts, 'source' is the staging (import) table row and 'target' is the destination table record. Setting ignore = true in onBefore skips the row. Setting error = true marks it as failed. Coalesce fields determine insert vs. update.

AD SPACE

Integration Hub & Spokes

Integration Hub extends Flow Designer with pre-built connectors (Spokes) for external services like Slack, Jira, Azure, AWS, and more.

Key Concepts

  • Spokes — Pre-built integration packages (e.g., Slack Spoke, Jira Spoke, Microsoft Teams Spoke).
  • Actions — Individual operations within a spoke (e.g., 'Send Slack Message', 'Create Jira Issue').
  • Used within Flow Designer flows — drag and drop spoke actions into flows.
  • Custom Spokes — Developers can build custom spokes for internal or marketplace distribution.
  • Credential Aliases — Secure storage for API keys and credentials used by spokes.
📝Exam Tip

Integration Hub is the preferred approach for third-party integrations. It's no-code/low-code via Flow Designer. Custom REST Messages are for integrations where no Spoke exists. The exam favors Integration Hub over custom scripted integrations.

Key Takeaways

  • Outbound REST: RESTMessageV2 with variable substitution. Always check getStatusCode() before parsing.
  • Inbound REST: Table API for CRUD, Scripted REST API for custom endpoints and logic.
  • Import Sets: source = staging row, target = destination record. ignore = true skips rows.
  • Integration Hub Spokes are the preferred approach for third-party integrations in Flow Designer.
  • REST Message is for OUTBOUND calls. Scripted REST API is for INBOUND calls. Don't confuse them.
  • Coalesce fields in Transform Maps determine whether to insert new records or update existing ones.
AD SPACE

Community-created study aids. Not official ServiceNow exam content.