Custom portlet for transaction links in NetSuite

The script for adding the custom portlet for showing transaction links with icons in the Dashboard.

/**
 * @NApiVersion 2.1
 * @NScriptType Portlet
 */

define([],

    function () {
        /**
         * Defines the Portlet script trigger point.
         * @param {Object} params - The params parameter is a JavaScript object. It is automatically passed to the script entry
         *     point by NetSuite. The values for params are read-only.
         * @param {Portlet} params.portlet - The portlet object used for rendering
         * @param {string} params.column - Column index forthe portlet on the dashboard; left column (1), center column (2) or
         *     right column (3)
         * @param {string} params.entity - (For custom portlets only) references the customer ID for the selected customer
         * @since 2015.2
         */
        const render = (params) => {
            try {
                params.portlet.title = "Transaction Links";
                let content =
                    '<html>' +
                    '<head>' +
                    '<style>' +
                    'div.divcontent{' +
                    'display: flex;' +
                    'flex-wrap: wrap; ' +
                    '}' +
                    'ul.ulcontent {' +
                    'display: flex;' +
                    'flex-direction: row;' +
                    'flex-wrap: wrap;' +
                    'padding: 0;}' +
                    'li.content { ' +
                    ' margin: 8px; ' +
                    'border: 1px solid #e8e8e8;' +
                    'border-radius: 5px; ' +
                    'padding: 5px; ' +
                    'width: 130px; ' +
                    'font-size: 13px; ' +
                    'list-style: none; ' +
                    'text-align:center;' +
                    'float: left;}' +
                    'a.acontent {' +
                    ' display: block;' +
                    ' padding: 16px;' +
                    'text-decoration: none;' +
                    'color: #255599;' +
                    'border-bottom: 0;' +
                    '}' +
                    'img.imgcontent {' +
                    ' display: block;' +
                    'margin: 0 auto;' +
                    ' }' +
                    '</style>' +
                    '<body>' +
                    '<div class="divcontent">' +
                    '<ul class="ulcontent">' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/custinvc.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/invoice.svg;  width="40 px" height="40 px">' +
                    'Create Invoice' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/salesord.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/salesorder.svg;  width="40 px" height="40 px">' +
                    'Create Sales Order' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/custcred.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/invoice.svg;  width="40 px" height="40 px">' +
                    'Create Credit Memo' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/custrfnd.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/generictransaction.svg;  width="40 px" height="40 px">' +
                    'Create Customer Refund' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/rtnauth.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/returnauthorization.svg;" width="40 px" height="40 px">' +
                    'Create Return Authorization' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/accounting/transactions/cashrfnd.nl?whence=" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/cashrefund.svg;" width="40 px" height="40 px">' +
                    'Create Cash Refund' +
                    '</a>' +
                    '</li>' +
                    '<li class="content">' +
                    '<a class ="acontent" href ="/app/crm/calendar/call.nl" target="_blank">' +
                    '<img class ="imgcontent" alt="Text icon" src="/uirefresh/img/recordicon/call.svg;" width="40 px" height="40 px">' +
                    'Phone Call' +
                    '</a>' +
                    '</li>' +
                    '</ul>' +
                    '</div>'
                '</body>'
                '</head>' +
                    '</html>';
                params.portlet.html = content;

            } catch (e) {
                log.error('error @ render', e);
            }
        }

        return { render }

    });

Leave a comment

Your email address will not be published. Required fields are marked *