Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer peopleโ€™s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer peopleโ€™s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Home/ NetSuite Customization Guide: Fields, Forms, Workflows & Scripts/Building Custom Portlets in NetSuite (Dashboard Widgets with SuiteScript)

Building Custom Portlets in NetSuite (Dashboard Widgets with SuiteScript)

๐Ÿงฉ Building Custom Portlets in NetSuite (Dashboard Widgets with SuiteScript)

Introduction

Portlets in NetSuite are dashboard widgets that display dynamic data โ€” from saved searches and KPIs to custom HTML, charts, and external data feeds.

While NetSuite provides standard portlets like Reminders, Key Performance Indicators, and Trend Graphs, you can take dashboards further by building Custom Portlets using SuiteScript 2.x.

Custom Portlets allow you to:

  • Display custom HTML interfaces, tables, and buttons.
  • Embed charts or KPIs from saved searches.
  • Call external APIs (e.g., Shopify orders, Salesforce updates).
  • Improve visibility for users and executives with tailored dashboards.

๐Ÿ’ก What Is a Custom Portlet?

A Custom Portlet is a SuiteScript-based dashboard component that you can deploy to any userโ€™s Home dashboard. Itโ€™s written using the Portlet script type in SuiteScript 2.x or 2.1.

AttributeDescription
Script TypePortlet
DeploymentPer-role or per-user basis
UI OutputHTML or form-style content
AccessDashboards โ†’ Personalize โ†’ Add Content โ†’ Custom Portlet

โš™๏ธ When to Use a Custom Portlet

Use a custom portlet when you need:

  • Dynamic dashboards tailored to business roles.
  • Interactive data summaries (e.g., Open Sales Orders, Recent Fulfillments).
  • Integration dashboards (display external API data).
  • Quick-action widgets (buttons to trigger Suitelets or RESTlets).

๐Ÿงฑ Step-by-Step: Creating a Custom Portlet

Step 1: Create a SuiteScript 2.1 Portlet File

Navigate to:
Customization โ†’ Scripting โ†’ Scripts โ†’ New โ†’ Portlet

Paste the following example:

/**
 * @NApiVersion 2.1
 * @NScriptType Portlet
 * @NModuleScope SameAccount
 */
define(['N/search', 'N/format'], (search, format) => {
    const render = (params) => {
        const portlet = params.portlet;
        portlet.title = 'Top 5 Open Sales Orders';

        // Create a simple table header
        let html = "<table style='width:100%; border-collapse:collapse;'>";
        html += "<tr style='background-color:#f3f3f3;'><th>Order #</th><th>Customer</th><th>Total</th></tr>";

        // Run a saved search dynamically
        const soSearch = search.create({
            type: search.Type.SALES_ORDER,
            filters: [['status', 'anyof', 'SalesOrd:A']], // Open
            columns: ['tranid', 'entity', 'total']
        });

        soSearch.run().each(result => {
            html += `<tr>
                <td>${result.getValue('tranid')}</td>
                <td>${result.getText('entity')}</td>
                <td>${format.format({value: result.getValue('total'), type: format.Type.CURRENCY})}</td>
            </tr>`;
            return true;
        });

        html += "</table>";
        portlet.html = html;
    };

    return { render };
});

This script builds a dashboard widget that lists Top 5 Open Sales Orders dynamically.


Step 2: Deploy the Portlet

  1. Go to Customization โ†’ Scripting โ†’ Scripts.
  2. Select your Portlet Script โ†’ click Deploy Script.
  3. Set the title (e.g., Sales Dashboard Widget).
  4. Assign the deployment to roles or users (e.g., Sales Manager).
  5. Set Status โ†’ Released.

Step 3: Add the Portlet to Dashboard

  1. Go to your Home dashboard.
  2. Click Personalize โ†’ Custom Portlet.
  3. Choose your new portlet from the dropdown (e.g., Sales Dashboard Widget).
  4. Click Save.

๐ŸŽ‰ Done โ€” your dashboard now displays a live, custom table of open Sales Orders.


๐Ÿงฎ Example: Integrating a Saved Search

To use an existing saved search instead of building one inside the script:

const mySearch = search.load({ id: 'customsearch_open_invoices' });
const results = mySearch.run().getRange({ start: 0, end: 10 });

Then loop through results and inject them into your HTML structure.


๐Ÿ“ˆ Example: Adding Simple Charts in Portlet

Use inline HTML and JavaScript libraries such as Chart.js (CDN accessible) for a quick chart portlet:

portlet.html = `
    <canvas id="salesChart"></canvas>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script>
        new Chart(document.getElementById('salesChart'), {
            type: 'bar',
            data: {
                labels: ['Jan','Feb','Mar','Apr'],
                datasets: [{ label: 'Sales', data: [200,300,250,400] }]
            }
        });
    </script>
`;

โœ… Tip: Keep scripts lightweight; heavy JS may slow dashboard load.


๐Ÿง  Advanced Use Cases

Use CaseDescription
Customer Credit SummaryDisplay available credit, overdue balance, and payment reminders.
Fulfillment TrackerShow daily item fulfillment totals by warehouse.
Integration FeedDisplay status of last API sync or Boomi process.
Performance KPI WidgetCombine multiple metrics (Sales, Margin, Conversion).
Task List PortletPull open tasks assigned to current user.

โšก Styling and UX Tips

  • Use <table> with border-collapse: collapse; for clean layout.
  • Add colors for headers and totals.
  • Limit rows (5โ€“10 max) for fast dashboard rendering.
  • Use icons via HTML entities (โœ…, โš ๏ธ, โณ).
  • Wrap content in <div style="overflow:auto; max-height:200px;"> for scrollable widgets.

๐Ÿ”’ Permissions and Deployment Control

  • Deploy portlets by role (e.g., Accountant, Sales Manager).
  • Control visibility through Audience tab.
  • You can have multiple deployments per script โ€” each with a different layout or data source.

๐Ÿงฐ Debugging and Maintenance

  • Check the Execution Log under Customization โ†’ Scripting โ†’ Script Deployments.
  • Add log.debug() inside the render function.
  • If HTML doesnโ€™t render, check for missing <table> closures or invalid tags.
  • Always test in Sandbox first.

๐Ÿงฉ Best Practices

  • Cache static data when possible.
  • Avoid running large saved searches on load โ€” preload with summary data.
  • Keep portlet width manageable (no horizontal scroll).
  • Combine data visualization and quick links for better UX.

๐Ÿ“š Related Tutorials

  • ๐Ÿ‘‰ SuiteAnalytics Workbook for Reporting
  • ๐Ÿ‘‰ Custom Buttons and Form Actions
  • ๐Ÿ‘‰ Advanced PDF Templates in NetSuite

โ“ FAQ

Q1. Can I use RESTlet or external API data in a portlet?
Yes โ€” but ensure the data call executes quickly (<2 s) to avoid dashboard timeouts.

Q2. How many custom portlets can a user have?
Up to five per dashboard, depending on screen size and layout.

Q3. Can I make the portlet interactive (e.g., click to open record)?
Yes โ€” embed hyperlinks to NetSuite records using record IDs in your HTML.

Q4. Can portlets auto-refresh?
Not natively; use JavaScript timers (setInterval()) or reload manually.


๐Ÿงญ Summary

Custom Portlets empower you to turn NetSuite dashboards into actionable, data-driven interfaces.
Whether displaying KPIs, search summaries, or external data โ€” portlets bridge the gap between backend analytics and real-time visibility.

Theyโ€™re one of the simplest yet most powerful ways to personalize user experience in NetSuite.

Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuiteโ€™s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 22 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

© 2025 The NetSuite Pro. All Rights Reserved