MessageData Object Members
Explore MessageData object members in SuiteScript 2.1, including methods and properties essential for handling messages.
The MessageData object in SuiteScript 2.1 provides various members essential for manipulating message data effectively. This object includes both properties and methods that facilitate access to detailed message characteristics and operations.
What Are the Members of the MessageData Object?
The MessageData object comprises the following members:
| Name | Type | Supported Script Types | Description |
|---|---|---|---|
| MessageData.filename | string | Server scripts | The name of a file. |
| MessageData.date | Date | Server scripts | The date of a message or modification date of the file. |
| MessageData.format | pgp.Format | Server scripts | Literal data packet type. |
| [MessageData.getText()] | string | Server scripts | Extracts the contents of a message as text. |
| [MessageData.toMessage()] | pgp.Message | Server scripts | Creates a message with no signature, compression, or encryption. |
| [MessageData.encrypt(options)] | pgp.Message | Server scripts | Creates a message that is encrypted and optionally signed. |
Property Details
MessageData.filename
- Type:
string - Description: The name of the file associated with the message.
- Error Handling: Attempting to set this property will trigger a
READ_ONLY_PROPERTYerror.
MessageData.date
- Type:
Date - Description: Represents the date of the message or the file's modification date.
- Error Handling: Attempting to set this property will also result in a
READ_ONLY_PROPERTYerror.
Key Methods of MessageData
MessageData.getText()
This method retrieves the complete text contained within the message.
MessageData.toMessage()
This method creates a fresh message object without any signatures, compression, or encryption—ideal for raw message handling.
MessageData.encrypt(options)
Generates an encrypted message, with the option to include a signature. This method enhances the security of the transmitted messages.
Conclusion
The MessageData object members are invaluable for developers working with message handling in SuiteScript 2.1, providing vital functionalities for managing encrypted messages and associated file data.
Who This Affects
- Administrators: Responsible for managing and configuring script use within their environment.
- Developers: Utilizing SuiteScript 2.1 for enhancing applications and features tied to message handling.
Key Takeaways
- The MessageData object plays a crucial role in managing message-related data in SuiteScript 2.1.
- Key properties include
filenameanddate, both of which are read-only. - Several methods facilitate text extraction and encryption of messages, enhancing data security.
Frequently Asked Questions (4)
What script types are supported by the MessageData object members?
Can you modify properties like filename or date in the MessageData object?
How does the MessageData.encrypt(options) method enhance message security?
Are there any methods in the MessageData object for handling message contents as text?
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.
