Skip to content

Instantly share code, notes, and snippets.

@SethWilson
Last active April 27, 2017 20:50
Show Gist options
  • Save SethWilson/2aa8b1a253594df81efd8b915f57d1b5 to your computer and use it in GitHub Desktop.
Save SethWilson/2aa8b1a253594df81efd8b915f57d1b5 to your computer and use it in GitHub Desktop.
This gist creates is a Userscript that adds a link to the NetSuite Debugger that lets you download the contents of the console to a file.
// ==UserScript==
// @name Add Ability to Download Log as File from NetSuite Debugger
// @namespace https://debugger.netsuite.com
// @version 0.1
// @description This script adds a
// @author S. Wilson.
// @match https://debugger.netsuite.com/app/common/scripting/scriptdebugger.nl?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var x = jQuery('table.bgsubtabbar tr');
x.append( '<td valign="middle" nowrap="" id="getlogasfilelnk" class="formsubtaboff"><a href="#" id="getlogasfile" class="formsubtabtext formsubtabtextoff"><span style="text-decoration:underline">G</span>et Log As File</a><span id="breakpointslnkdot" class="uir-tab-content-dot formsubtabtext formsubtabtextoff" style="display: none;"> </span></td>');
jQuery("#getlogasfile").click(function() {
var console_data = '';
jQuery("table[id^=console] tr:nth-child(2) td:nth-child(2)").each(function( index ) {
console_data += $( this ).innerText;
console_data += "\r\n";
});
var blob=new Blob([console_data], {type: 'text/plain'});
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download= "NSDebuggerLog-"+ jQuery.now() + ".txt"; link.click();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment