Skip to content

Instantly share code, notes, and snippets.

@SethWilson
Last active March 10, 2023 15:50
Show Gist options
  • Save SethWilson/8a4e74c2f077616e539806e8d3358cf2 to your computer and use it in GitHub Desktop.
Save SethWilson/8a4e74c2f077616e539806e8d3358cf2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Add Local Files to NetSuite SuiteScript Debugger
// @namespace https://debugger.netsuite.com
// @version 0.1
// @description This script adds a file input in the command toolbar of NetSuite's script debugger. You can then add a local file to the text area to debug
// @author S. Wilson.
// @match https://debugger.netsuite.com/app/common/scripting/scriptdebugger.nl?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.loadExternalFile = function() {
var file = document.getElementById("myFile").files[0];
var reader = new FileReader();
reader.onload = function (e) {
var textArea = document.getElementById("mainscript");
textArea.value += e.target.result; };
reader.readAsText(file);
};
var x = document.getElementsByClassName('uir-header-buttons');
var x0 = x[0];
var tr = x0.firstChild.nextSibling.firstChild.nextSibling.firstChild;
var td0 = document.createElement('td');
td0.innerHTML ='<input id="myFile" onchange="loadExternalFile();" type="file">';
tr.append(td0);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment