have you guys ever written any kind of scripts to ...
# general
j
have you guys ever written any kind of scripts to overcome an issue in NS, maybe a greasemonkey script or similar? is that doable?
m
Yes for sure doable. Here's one that I adapted that makes headers fixed in sublists (scroll down for the bottom comment) https://netsuitehub.com/forums/topic/locked-sublist-column-headers/
Here's another one that I use on a custom record to prettify a custom text field with a JSON payload
Copy code
// ==UserScript==
// @name         Prettify staging record JSON payload
// @namespace    <http://tampermonkey.net/>
// @version      0.1
// @description  Display the JSON payload field for "Staging" Custom Records as a prettified JSON tree
// @author       Michoel Chaikin <michoel.chaikin@carsales.com.au>
// @match        https://*.<http://app.netsuite.com/app/common/custom/custrecordentry.nl?rectype=187*|app.netsuite.com/app/common/custom/custrecordentry.nl?rectype=187*>
// @require      <https://code.jquery.com/jquery-3.3.1.min.js>
// @require      <https://unpkg.com/jquery.json-viewer@1.4.0/json-viewer/jquery.json-viewer.js>
// @resource     JSONViewerCSS <https://unpkg.com/jquery.json-viewer@1.4.0/json-viewer/jquery.json-viewer.css>
// @grant        GM_addStyle
// @grant        GM_getResourceText
// ==/UserScript==

/* global nlapiGetFieldValue, nlapiLookupField, nlapiGetRecordType, nlapiGetRecordId */

(function ($, undefined) {
    'use strict';

    const jsonViewerCSS = GM_getResourceText("JSONViewerCSS");
    GM_addStyle(jsonViewerCSS);

    $(function () {
        // Don't run if record is in Edit mode
        if(nlapiGetFieldValue('name')) {
            return;
        }

        const jsonPayload = nlapiLookupField(nlapiGetRecordType(), nlapiGetRecordId(), 'custrecord_fsg_st_json');
        $('#custrecord_fsg_st_json_fs_lbl_uir_label')
            .next()
            .jsonViewer(JSON.parse(jsonPayload), { collapsed: true, rootCollapsable: false });
    })

})(window.jQuery.noConflict(true));
👍 2