Document Object Members for SuiteScript 2.1 Reference
Document Object Members provide crucial properties for SuiteScript 2.1, including data content and ID retrieval for effective document handling.
Document Object Members facilitate the interaction with document-related properties within SuiteScript 2.1. This article explains the primary members, their types, and associated functionality, guiding developers to effectively utilize the Document object.
What Are Document Object Members?
The Document object members are essential properties that enable access to the content and unique identifiers of documents in SuiteScript 2.1. These members are designed for use within server scripts.
Document Object Members Overview
This section outlines the key members associated with the Document object:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Document.data | string | Server scripts | The content of the document. |
Document.id | string | Server scripts | The ID of the document. |
Property Details
Document.data
- Type:
string - Description: This property returns the content of a document. You specify the content using the
options.dataparameter when callingllm.createDocument(options). - Errors: Setting this property results in a
READ_ONLYerror if an attempt is made to modify it.
Document.id
- Type:
string - Description: This property returns the unique ID of a document. To specify the ID while creating a document, use the
options.idparameter inllm.createDocument(options). - Errors: Similar to
data, attempting to modify this property will throw aREAD_ONLYerror.
Syntax Example
The syntax below demonstrates how to utilize these members within a SuiteScript context:
1// The documents doc1 and doc2 are created using llm.createDocument(options)2const response = llm.generateText({3 prompt: "My test prompt",4 documents: [doc1, doc2]5});6 7// Retrieving document properties from the response8const documents = response.documents;9for (var i = 0; i < documents.length; i++) {10 var data = documents[i].data;11 var id = documents[i].id;12 // Process the document properties as needed13}Conclusion
Understanding Document Object Members is essential for effective document management within SuiteScript 2.1 scripts. By leveraging these properties, developers can streamline the handling of document data and identifiers.
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- Document object enables easy access to document content and ID in SuiteScript 2.1.
- Members are read-only; attempts to modify them will trigger errors.
- Proper usage of these members enhances document management in scripts.
Frequently Asked Questions (4)
Can Document Object Members be used in client scripts or only server scripts?
What happens if I try to modify the Document.data or Document.id properties?
How do I initialize the content or ID of a Document object in SuiteScript 2.1?
Is there any way to retrieve documents' content and ID simultaneously?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- New Role Setup for NetSuite AI Connector Service in 2026.1
The 2026.1 release adds a new role requirement for the NetSuite AI Connector Service, streamlining custom tool development.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category