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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- SuiteScript 2.x Sublist Values: Standard and Dynamic Mode
Use setSublistValue in standard mode; select a line, set its current value and commit it in dynamic mode. Choose the API from the record's mode.
- SuiteScript Record.setValue: Body Fields, Types and Errors
Set NetSuite body fields with Record.setValue, matching field IDs and value types and checking common API errors.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
