Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View W3BGUY's full-sized avatar
🤐
Burnt Out

w3bguy W3BGUY

🤐
Burnt Out
View GitHub Profile
@W3BGUY
W3BGUY / CB_CM_CustomModule.js
Created March 12, 2020 15:50
NetSuite_SuiteScript_2.0_Custom_Module
/**
* CB_CM_CustomModule.js
* @NApiVersion 2.x
* @NModuleScope SameAccount
*
* @Author: Charles.Bastian
* @Created: 2020-03-12
* @ScriptName: CB_CM_CustomModule
* @Filename: CB_CM_CustomModule.js
* @ScriptID:
@W3BGUY
W3BGUY / JavaScript - Remove Duplicates from Array
Created September 10, 2019 18:49
On liner that can be used to remove duplicates from an array. Great for use in NetSuite scripts.
var newArray=oldArray.reduce(function(a,b){if(a.indexOf(b)<0)a.push(b);return a;},[]);
@W3BGUY
W3BGUY / NetSuite_RESTlet_Query_File_Contents_by_InternalID.js
Last active January 25, 2023 15:18
Simple NetSuite SuiteScript 2.0 RESTlet to gather file information, since the basic call does not return the file contents.
/**
* @NApiVersion 2.0
* @NScriptType Restlet
* @NModuleScope SameAccount
* @Author Charles.Bastian
* @Created 2019-03-13
* @ScriptName NetSuite_RESTlet_Query_File_Contents_by_InternalID
* @Filename NetSuite_RESTlet_Query_File_Contents_by_InternalID.js
* @ScriptID customscript_rs_get_file_contents
* @Production
@W3BGUY
W3BGUY / netsuiteCountryDict.txt
Last active August 8, 2019 19:04
Jitterbit - Country/Country Codes to NetSuite Country Format
<trans>
/*
convert input country names/abbreviations to the NetSuite country code
*/
$netsuiteCountryDict = Dict();
$netsuiteCountryDict["Afghanistan"]="_afghanistan";
$netsuiteCountryDict["Albania"]="_albania";
$netsuiteCountryDict["Algeria"]="_algeria";
$netsuiteCountryDict["American Samoa"]="_americanSamoa";
<trans>
accoundAddressSFCountry=CASE(
accountAddressNSCountry=="_afghanistan","AF",
accountAddressNSCountry=="_alandIslands","AX",
accountAddressNSCountry=="_albania","AL",
accountAddressNSCountry=="_algeria","DZ",
accountAddressNSCountry=="_americanSamoa","AS",
accountAddressNSCountry=="_andorra","AD",
accountAddressNSCountry=="_angola","AO",
accountAddressNSCountry=="_anguilla","AI",

Keybase proof

I hereby claim:

  • I am w3bguy on github.
  • I am w3bguy (https://keybase.io/w3bguy) on keybase.
  • I have a public key whose fingerprint is F479 2C98 E845 D1CE 2D3D F345 217D 187E EBD9 D29A

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am w3bguy on github.
  • I am w3bguy (https://keybase.io/w3bguy) on keybase.
  • I have a public key whose fingerprint is DFB0 0181 BFFE 2D61 8F56 F5B1 CC98 37AC B550 E038

To claim this, I am signing this object:

@W3BGUY
W3BGUY / JitterBit-Remove_Non-Numeric
Created November 16, 2016 18:17
JitterBit - Remove all non-numeric characters from string
//Simple way to remove all non-numeric characters from a string, in JitterBit
$phone=RegExReplace($phone,"(\\D)","");
@W3BGUY
W3BGUY / NetSuite_Get_Number_Of_Days_In_Month.js
Created November 16, 2016 15:58
NetSuite Get Number of Days in Month
// function to figure out the number of days in month.
function getDaysInMonth(thisMonth,thisYear){
var monthArray=[31,28,31,30,31,30,31,31,30,31,30,31];
if(thisMonth!=2){return monthArray[thisMonth-1]};
if(thisYear%4!=0){return monthArray[1]};
if(thisYear%100==0 && thisYear%400!=0){return monthArray[1]};
return monthArray[1]+1;
}
// NetSuite usage example
@W3BGUY
W3BGUY / NetSuite_Convert_Date_Obj_To_NS_Datetime.js
Last active November 16, 2016 16:01
NetSuite - Convert Date Object into NetSuite usable Datetime Format
// function to add leading zeros on date parts.
function zeroPad(num,len){
var str=num.toString();
while(str.length<len){str='0'+str;}
return str;
}
// function to format date object into NetSuite's mm/dd/yyyy HH:MM:SS format.
function formatNSDateTime(dateObj){
if(dateObj){