Message Object Members in SuiteScript 2.1 Reference
Message object members in SuiteScript 2.1 enable message processing with methods for encoding and decryption.
The Message Object Members in SuiteScript 2.1 provide a set of properties and methods crucial for handling messages effectively in your scripts. These functionalities support various operations, including processing and converting message formats, offering a powerful toolkit for server-side scripting.
Overview of Message Object Members
Properties
| Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|
Message.type | boolean | Server Scripts | Specifies how a message is processed, allowing for the appropriate method selection. |
Methods
| Method | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|
Message.asArmored() | string | Server Scripts | Converts a message to ASCII armored format. |
Message.toMessageData() | pgp.MessageData | Server Scripts | Converts a message to message data if it is not encrypted. |
Message.decrypt(options) | pgp.MessageData | Server Scripts | Decrypts a message and verifies signatures, if required. |
Syntax
The following are syntax examples for these members. Note that they are not functional examples. For a complete script implementation, you could refer to resources like the N/pgp Module Script Samples.
Example for Message Type
// Additional code here...const message = msgData.toMessage(); // creates Message objectlog.debug(message.type);// Additional code here...Example for ASCII Armored Format
// Additional code here...const message = msgData.toMessage(); // creates Message objectlog.debug(message.asArmored());// Additional code here...Error Handling
When working with the Message object, it's important to be aware of error codes that may arise:
READ_ONLY_PROPERTY: This error occurs if a write operation is attempted on a read-only property.
Related Resources
- Visit the pgp.Message documentation for more details on the message structure and functionalities.
- Explore the N/pgp Module for comprehensive scripting guides and examples.
- Review the SuiteScript 2.x Modules for related operational capabilities.
Key Takeaways
- The Message Object in SuiteScript 2.1 facilitates robust message processing.
- Properties and methods available streamline encoding and decryption processes.
- Understanding error handling is essential for effective scripting.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Does the Message Object apply to both client and server scripts in SuiteScript 2.1?
What happens if I try to write to a read-only property of the Message object?
How can I convert a message into an ASCII armored format using SuiteScript 2.1?
Is there a method for decrypting messages in SuiteScript 2.1's Message Object?
Was this article helpful?
More in Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category