SuiteScript 2.x Custom List Pages
Custom list pages can be created using a Suitlet or a Portlet. Buttons, columns, page links, and rows can all be included on a custom list page.
Supported Script Types for Custom List Page Creation
You can use the following script types to create custom list pages:
-
Suitelet: Suitelets provide the most flexibility for creating a list. Suitelets can process requests and responses directly, giving you control over the data included in a list. For information about Suitelets, see SuiteScript 2.x Suitelet Script Type.
-
Portlet: Portlets are rendered within dashboard portlets. For information about portlet scripts, see SuiteScript 2.x Portlet Script Type.
Supported UI Components for Custom List Pages
You can use any of the following components on your custom list page: buttons, columns, page links, and rows.
Buttons
Add a button to a list page to trigger custom functions.
-
For information about adding a button, see List.addButton(options).
Columns
A column contains an editable or read-only field that displays a record value. Column properties are defined using the supported field types specified in serverWidget.FieldType. An Edit column is a special column that adds links to edit and view each record or row in the list.
-
For information about adding columns to a list page, see List.addColumn(options).
-
For information about adding an edit column, see List.addEditColumn(options).
Use a URL column to add a website to each row in a list. Use ListColumn.setURL(options) to specify the base URL for the website, and ListColumn.addParamToURL(options) to assign additional properties to a URL column.
Page Link
Page links on list pages can be either a breadcrumb link or a crosslink. Breadcrumb links display a series of links leading to the location of the current page. Crosslinks are used for navigation, including links such as Forward, Back, List, Search, and Customize.
-
For information about page link types, see serverWidget.FormPageLinkType.
-
For information about adding page links, see List.addPageLink(options).
Rows
Each row in a list represents a single record. You can add a single row or multiple rows to a custom list page by specifying the column ID and value for each row.
-
For more information about adding a single row, see List.addRow(options).
-
For more information about adding multiple rows, see List.addRows(options).
Sample
/**
* @NScriptType Suitelet
* @NApiVersion 2.x
*/
define([ 'N/ui/serverWidget'], function(serverWidget) {
return {
onRequest : function(context) {
var list = serverWidget.createList({
title:"List"
});
list.addColumn({
id: 'column1',
type: serverWidget.FieldType.TEXT,
label: 'Text',
align: serverWidget.LayoutJustification.LEFT
});
context.response.writePage(list);
}
});