N/portlet Module Features for SuiteScript Customization

The N/portlet module allows developers to resize and refresh form portlets in SuiteScript, enhancing dashboard usability and functionality.

·2 min read·View Oracle Docs

TL;DR Opening

The N/portlet module in SuiteScript enables developers to resize and refresh form portlets on the NetSuite dashboard. This capability is crucial for optimizing user interaction and enhancing functionality within custom applications.

What is the N/portlet Module?

The N/portlet module is designed for managing portlet functionalities within the NetSuite environment. By using this module, developers can improve the usability of form portlets by allowing immediate adjustments in size and content refreshing directly from client scripts.

Key Members of the N/portlet Module

The following methods are available to manipulate portlet size and content:

MemberTypeReturn TypeSupported Script TypesDescription
portlet.resize()MethodvoidClient scriptsResizes a form portlet immediately.
portlet.refresh()MethodvoidClient scriptsRefreshes a form portlet immediately.

Using N/portlet Methods

Both methods can be invoked in client scripts to enhance the user interface. For example, you might use portlet.resize() to allow users to adjust the portlet dimensions based on their preferences or display current information dynamically using portlet.refresh(). Consider incorporating these methods strategically to improve the overall responsiveness of your dashboard.

Sample Code for Portlet Creation

The following script demonstrates how to implement the N/portlet module to create a form portlet that users can interact with:

suitescript
1/**
2 * @NApiVersion 2.x
3 * @NScriptType Portlet
4 * @NScriptPortletType form
5 */
6
7define([], function() {
8 function render(context) {
9 var portletObj = context.portlet;
10 portletObj.title = 'Test Form Portlet';
11 setComponentsForResize();
12 setComponentsForRefresh();
13
14 function setComponentsForResize() {
15 var DEFAULT_HEIGHT = '50';
16 var DEFAULT_WIDTH = '50';
17 var inlineHTMLField = portletObj.addField({
18 id: 'divfield',
19 type: 'inlinehtml',
20 label: 'Test inline HTML'
21 });
22 inlineHTMLField.defaultValue = '<div id=\'divfield_elem\' style=\'border: 1px dotted red; height: ' + DEFAULT_HEIGHT + 'px; width: ' + DEFAULT_WIDTH + 'px;\'></div>';
23 }
24 }
25 return {
26 render: render
27 };
28});

Who This Affects

This functionality primarily affects:

  • Developers: They can create adaptive dashboards based on user needs.
  • Administrators: Enhanced dashboard functionality can lead to better user engagement and data visualization.

Key Takeaways

  • The N/portlet module enhances dashboard usability through resizable and refreshable form portlets.
  • It includes two main methods: portlet.resize() and portlet.refresh(), supporting dynamic user interfaces.
  • Developers can create customized forms using the provided sample code to implement portlet features effectively.

Frequently Asked Questions (4)

Do I need to enable a feature flag for the N/portlet module to work?
The article does not specify any feature flag requirements for the N/portlet module. It appears to be available as part of the standard SuiteScript functionality.
What script types support the N/portlet resize and refresh methods?
The `portlet.resize()` and `portlet.refresh()` methods are supported in client scripts.
How can I use the N/portlet module to enhance user interaction on my dashboard?
You can use the `portlet.resize()` method to allow users to adjust portlet dimensions and the `portlet.refresh()` method to display updated content dynamically, enhancing the dashboard's responsiveness.
What should developers consider when incorporating N/portlet methods into their dashboards?
Developers should strategically use the `resize` and `refresh` methods to ensure adaptive and responsive dashboards that meet user preferences and display relevant information in real time.
Source: N/portlet Module Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?