Script processors

concept brazil Updated Sep 10, 2026 4 min read c_Processors.md
Raw file servicenow.com

Processors provide a customizable URL endpoint that can execute arbitrary server-side JavaScript code and produce output such as TEXT or JSON. Creating custom processors is deprecated.

Note: This feature is deprecated. While legacy, existing custom processors continue to be supported, creating new custom processors has been deprecated. Instead, use the Scripted REST APIs.

Warning: When creating a processor, ensure that you use parameter names that are specific to your processor. For example, if your processor exports a list of legal records, and a necessary parameter is the recipient's email address, don't use “email” as the parameter name. Create a more processor specific parameter name, such as legal_export_recipient_email. Failure to do so, and using instance parameter names, such as id, table, sys_id, service, catalog_id, or view (and others), can cause unexpected results.

When to create processors

Do not create custom processors. This feature is deprecated. Please use the REST APIs instead of creating custom processors. The remaining information is left for existing processors only.

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>.

Note: Parameter names must be processor-specific. Do not choose common parameter names that another processor might use. If you use a common parameter name, such as id, sys_id or table in a processor, it can break other functionality, since the processor wins when that parameter exists in a URL. For example, a processor with an id parameter, regardless of the Path value in the same record, breaks the Service Portal, which depends on that parameter for page identification.

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
**Parent Topic:**[Writing server-side scripts](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/scripts/server-side-scripting-overview.md)

Processor API components

Processors have access to dedicated API classes, objects, and methods.

Class, object, or method Description
g_response An object of type HttpServletResponse. See GlideServletResponse.
setContentType(‘text/html;charset=UTF-8’) A GlideServletResponse method to set the content type of the response being sent to the client.
g_request An object of type HttpServletRequest. See HttpServletRequest.
getParameter() A glide method to get the value of a URL parameter.
canRead() A GlideRecord method to determine if the user can read data from a table. See GlideRecord.
g_processor A simplified servlet for processors. See GlideScriptedProcessor.
writeOutput() A GlideScriptedProcessor method to display information on the client.
g_target An object containing the target table name of a processor URL. For example, a processor containing the URI incident.do applies to the Incident table.

Secure a script processor against unauthorized access

You can protect your processor against unauthorized use by using role restrictions, and protect it by requiring a CSRF token.

About this task

Note: This feature is deprecated. While legacy, existing custom processors continue to be supported, creating new custom processors has been deprecated. Instead, use the Scripted REST APIs.

You can re-use a table's user role restrictions to protect it from access by your processor. This protection method assumes the processor will access table data.

Procedure

  1. Create or select a user role that has access to the table the processor script calls.

  2. Navigate to System Definition > Processors.

  3. In Script, add the following code block.

    JavaScript
    var now_GR = new GlideRecord('your_table_name');// canRead() compares the table’s ACL to the user making this request, and returns true if the logged-in user has read access to this tableif(gr.canRead())  {   // Perform table query here    g_processor.writeOutput('Success!'); } else {   g_processor.writeOutput('You do not have permission to read table your_table_name'); }
  4. Update the code block to use other access restrictions as needed.

    Available access functions include:

    • canCreate()
    • canRead()
    • canWrite()
    • canDelete()
  5. Click Update.

Protect a processor with a CSRF token

You can protect a processor by requiring a CSRF token.

About this task

Script type processors can require a CSRF token check before the processor runs.

Procedure

  1. Navigate to All > System Definition > Processors.

  2. Open a processor record.

  3. Select the CSRF protect option.

  4. Click Update.

Related topics

Assign a role to a user

Search documentation
Search document titles and file paths on the brazil branch