Processors

Processors provide a customizable URL endpoint that can execute arbitrary server-side JavaScript code and produce output such as TEXT, JSON, or HTML.

Typically, you create processors when you want a URL query to:

  • Perform non-standard record operations.
  • Contain complex logic as part of the API.
  • Act on multiple tables.
  • Create a logical API that can abstract implementation details.

When to create processors

Use this table to determine whether you should use existing functionality or create a processor.

Table 1. Processors creation guidelines
Requirement Recommendation
Perform basic operations such as create, read, update, or delete records. Use an existing web service, such as the REST API, or use an existing processor, such as Export to PDF.
Export data to a standard format such as JSON, CSV, PDF, Excel, or XML.
Operate on or export data from a single table.
Perform non-standard operations such as compute aggregation values. Create a processor.
Export data in a non-standard format such as SQL.
Operate on or export data from multiple tables.

Processor form

Field Description
Name Unique name of the processor.
Type

Programming language of the processor script.

Options include:

  • java: do not select this option
  • script
Application Application containing this record.
Active Flag to enable or disable the record.
CSRF protect Option to protect the processor from running unless the instance uses a CSRF token.
Description Description of the processor's function or purpose.
Parameters

List of available input parameters.

Specify parameter values in the URL as <parameter name>=<parameter value>.

Path

URI path used to call this processor.

Call a processor from the URL as:

https://<instance name>.service-now.com/<Path>.do

Script

Immediately Invoked Function Expression to run when the system calls this processor.

The function automatically provides input parameters for the following API objects.

  • g_request
  • g_response
  • g_processor
Protection policy

Policy to use to protect this record's script.

Options include:

  • None
  • Read-only
  • Protected