Server Response Redirect Method in SuiteScript
The server response redirect method enables redirecting URLs to NetSuite resources, essential for dynamic navigation in SuiteScript.
The server response redirect method allows developers to set a redirect URL that resolves to various NetSuite resources. This functionality is particularly useful for directing users to specific pages, such as a new sales order for a particular entity.
Method Details
- Returns:
void - Supported Script Types: Server scripts
- Governance: None
- Module: N/http Module
- Parent Object: http.ServerResponse
Parameters
The options parameter must be a JavaScript object containing the following properties:
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
options.identifier | `number | string` | Required |
MEDIA_ITEM: Internal ID of a file in the File CabinetRECORD: Use the appropriaterecord.TypeRESTLET: Script ID of the RESTletSUITELET: Script ID of the SuiteletTASK_LINK: Valid Task ID
|
|options.type| http.RedirectType | Required | Specifies the type of resource to redirect to.
|
|options.editMode|boolean| Optional | If redirecting to a record, this indicates whether the URL should be in edit mode (true) or view mode (false, default).
|
|options.id|number | string| Optional | ForSUITELETorRESTLET, this is the deployment ID; forRECORD, the internal ID of the specific record instance.
|
|options.parameters|Object| Optional | Additional URL parameters as name:value pairs.
Errors
The method may throw the following errors:
SSS_INVALID_RECORD_TYPE: Indicates an invalid or unavailable record type.SSS_INVALID_SCRIPT_ID_1: Signifies an invalid script ID for Suitelets or RESTlets.SSS_INVALID_TASK_ID: Indicates an invalid Task ID for task link redirection.SSS_INVALID_URL_CATEGORY: Thrown when an unsupportedoptions.typeis specified.SSS_MISSING_REQD_ARGUMENT: Indicates when required parameters are missing.
Syntax Example
Here is a sample of how to use this method:
1// Example of redirecting to a sales order 2myServerResponseObj.sendRedirect({ 3 type: http.RedirectType.RECORD, 4 identifier: record.Type.SALES_ORDER, 5 parameters: {entity: 8} 6}); Additional Resources
For further details on related topics, refer to:
- http.ServerResponse
- N/http Module
- SuiteScript 2.x Modules
Understanding the server response redirect method is essential for enhancing user navigation within the SuiteScript environment and facilitating dynamic interactions with NetSuite resources.
Frequently Asked Questions (4)
Which script types support the server response redirect method in SuiteScript?
What happens if I forget to include a required parameter when using the redirect method?
Can I use the server response redirect method to redirect to a Suitelet using its script ID?
How can I pass additional URL parameters when redirecting to a NetSuite resource?
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