Document Object Members in SuiteScript 2.1 Machine Translation
Document Object Members provide essential properties for SuiteScript 2.1's machine translation functionality, enabling document management in scripts.
TL;DR Opening
Document Object Members are integral to the SuiteScript 2.1 machine translation module, allowing developers to manage documents effectively for translation tasks. This includes handling document IDs, languages, and text content that can be translated.
Overview of Document Object Members
The Document Object in SuiteScript 2.1 includes several key members, each serving a specific function in managing document data. The main members are as follows:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Document.id | string | Server scripts | The ID of the document. |
Document.language | string | Server scripts | The language of the document. |
Document.text | string | Server scripts | The content of the document. |
Member Details
Document.id
The Document.id property stores a unique identifier for the document. It's essential that all document IDs passed to the machineTranslation.translate(options) function are unique to ensure proper processing.
Document.language
This property denotes the language in which the document is written. If this property is left null, the translation service will automatically detect the document's source language. Additionally, when receiving translated documents, this property indicates the target language into which the document contents have been translated.
Document.text
Document.text holds the actual text content of the document, which is to be translated.
Error Handling
Both Document.id and Document.language properties are read-only. Attempting to set these properties will result in a READ_ONLY error code.
Example Syntax
Here is a syntactical representation of how to utilize these members. Note that this example is not functional as a complete script; it serves only to demonstrate syntax usage:
1const myDocument = machineTranslation.createDocument({2 id: 'myDoc',3 text: 'This is a document to be translated.'4});5 6const translationResults = machineTranslation.translate({7 documents: [myDocument],8 targetLanguage: machineTranslation.Language.CZECH9});10 11const docId = translationResults.results[0].id;Who This Affects
- Developers: They can implement document translation features using the properties detailed above.
- Administrators: Administrators may need to configure permissions and settings associated with document management in machine translation.
Key Takeaways
- Document members in SuiteScript 2.1 facilitate efficient document handling for machine translation.
- Each document requires a unique ID for the translation process.
Document.languageandDocument.textare pivotal for successful translation workflow.
Frequently Asked Questions (4)
Which script types support the use of Document Object Members in SuiteScript 2.1?
Can I change the value of Document.id or Document.language in SuiteScript 2.1?
What happens if the Document.language property is set to null?
How should Document.id be handled when managing multiple documents for translation?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
