Server Response Send Redirect Method in SuiteScript
The sendRedirect method in SuiteScript allows redirection to specific NetSuite resources, enhancing navigation within scripts.
The sendRedirect method in SuiteScript enables developers to set a redirect URL that points to various NetSuite resources, facilitating a smoother navigation experience within applications. This method is particularly useful for redirecting users to specific pages, such as new sales orders for particular entities.
Method Description
The sendRedirect method resolves to a NetSuite resource based on provided parameters. Below is a summary of the functionality:
- Returns: The method returns
void. - Supported Script Types: Applicable in server scripts.
- Governance: There is no governance limit associated with this method.
Module: N/http Module
Parent Object: http.ServerResponse
Since: 2015.2
Parameters
When using the sendRedirect method, you can supply an options parameter, which is a JavaScript object, including the following:
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
options.identifier | number or string | Required | The primary ID for the resource, based on the options.type. Different values apply for MEDIA_ITEM, RECORD, RESTLET, SUITELET, and TASK_LINK. |
options.type | http.RedirectType | Required | The type of resource for redirection. |
options.editMode | boolean | Optional | Defines whether the redirect is in edit mode (true) or view mode (false). Defaults to false. |
options.id | number or string | Optional | Secondary ID for this resource. Used for deployment ID with SUITELET or RESTLET types. |
|| options.parameters | Object | Optional | Additional URL parameters as name:value pairs to be included in the redirect. |
Errors
Several error codes can be triggered when using sendRedirect:
SSS_INVALID_RECORD_TYPE: An invalid record type is provided inoptions.identifier.SSS_INVALID_SCRIPT_ID_1: An invalid script ID is used for a Suitelet or RESTlet.SSS_INVALID_TASK_ID: A provided task ID is not valid.SSS_INVALID_URL_CATEGORY: An unrecognized string value foroptions.type.SSS_MISSING_REQD_ARGUMENT: A required argument is missing.
Syntax Example
Below is an example of how to use the sendRedirect method:
1// Add any additional code here2...3myServerResponseObj.sendRedirect({4 type: http.RedirectType.RECORD,5 identifier: record.Type.SALES_ORDER,6 parameters: {entity: 8}7});8...9// Continue with more codeFor further details on the http.ServerResponse and N/http module, refer to the respective documentation sections.
Related Topics
- http.ServerResponse
- N/http Module
- SuiteScript 2.x Modules
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Does the sendRedirect method in SuiteScript have any governance limits?
What types of resources can I redirect users to using the sendRedirect method?
What are the required parameters for using the sendRedirect method in SuiteScript?
What errors might be encountered when using the sendRedirect method incorrectly?
Was this article helpful?
More in Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category