The N/portlet module is used in Portlet script types to add custom widgets to the NetSuite Dashboard. Portlets can display summaries, charts, lists, links, and custom HTML β all built with SuiteScript.
Portlet Script Structure
/**
* @NApiVersion 2.1
* @NScriptType Portlet
*/
define(["N/portlet", "N/search", "N/log"], (portlet, search, log) => {
const render = (params) => {
const p = params.portlet;
p.title = "Open Sales Orders";
p.html = "<p>Loading data...</p>";
const results = [];
search.create({
type: "salesorder",
filters: [["status", "anyof", "SalesOrd:B"]],
columns: ["tranid", "entity", "amount"]
}).run().each((r) => {
results.push(r.getValue("tranid") + " - " + r.getText("entity"));
return results.length < 10;
});
p.html = "<ul>" + results.map((r) => "<li>" + r + "</li>").join("") + "</ul>";
};
return { render };
});
Portlet Column Types
| Property | Description |
|---|---|
portlet.title | Title shown in the portlet header |
portlet.html | HTML content displayed in the portlet body |
portlet.addLine(options) | Add a text line to the portlet |
portlet.addColumn(options) | Add a column to a list portlet |
portlet.addRow(options) | Add a row to a list portlet |