Response Object Members in SuiteScript Machine Translation
Response Object Members provide access to translation results and errors in SuiteScript, enhancing error handling and document processing.
The Response Object Members in SuiteScript's machine translation module are crucial for handling translation tasks. Understanding these members allows developers to effectively manage errors and retrieve translated documents.
What are Response Object Members?
Response Object Members are properties within the machine translation service that return errors and results from document translations. This helps developers understand any issues that arise during the translation process and manage outputs effectively.
Key Properties
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Response.errors | machineTranslation.Error[] | Server scripts | Contains any errors that occurred during translation. |
Response.results | machineTranslation.Document[] | Server scripts | Contains the translated documents from the service. |
Property Descriptions
-
Response.errors: This property will hold an array of
machineTranslation.Errorobjects. Each object represents a specific error encountered during the translation process, such as unrecognized characters in the text. If no errors occurred, this array is empty. -
Response.results: This property returns an array of translated documents. Each document is represented as a
machineTranslation.Documentobject, allowing easy retrieval and handling of translation outputs.
Error Handling
Common Error Codes
| Error Code | Thrown If |
|---|---|
READ_ONLY | Attempting to set the property value. |
Example Syntax
The following code demonstrates how to use the properties of the Response Object. Note that while this is not a functional example, it highlights how to handle translation results and errors.
1// Add additional code2...3 4const myDocument = machineTranslation.createDocument({5 id: 'myDoc',6 text: 'This is a document to be translated.'7});8 9const translationResults = machineTranslation.translate({10 documents: [myDocument],11 targetLanguage: machineTranslation.Language.CZECH12});13 14if (translationResults.errors.length) {15 // Handle the error message16 const docErrorId = translationResults.errors[0].documentId;17 const docErrorMessage = translationResults.errors[0].message;18}19 20...21// Add additional codeConclusion
Understanding the Response Object Members in SuiteScript enables developers to efficiently process translations and manage errors during the translation process. Effective error handling not only enhances the user experience but also ensures accurate translations and proper functionality of applications.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What are Response Object Members in SuiteScript?
Which script types support the use of Response Object Members?
What happens if an error occurs during the translation process in SuiteScript?
Can I modify the properties of Response Object Members such as 'Response.errors'?
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