Skip to content

Instantly share code, notes, and snippets.

Avatar
🤐
Burnt Out

Charles Bastian W3BGUY

🤐
Burnt Out
View GitHub Profile
View jitterbit_NetSuite_to_Salesforce_Country_Conversion.js
<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",
View keybase.md

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:

View keybase.md

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 Nov 16, 2016
JitterBit - Remove all non-numeric characters from string
View JitterBit-Remove_Non-Numeric
//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 Nov 16, 2016
NetSuite Get Number of Days in Month
View NetSuite_Get_Number_Of_Days_In_Month.js
// 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 Nov 16, 2016
NetSuite - Convert Date Object into NetSuite usable Datetime Format
View NetSuite_Convert_Date_Obj_To_NS_Datetime.js
// 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){
@W3BGUY
W3BGUY / NetSuite_Convert_Date_Obj_To_NS_Date.js
Last active Nov 16, 2016
NetSuite - Convert Date Object into NetSuite usable Date Format
View NetSuite_Convert_Date_Obj_To_NS_Date.js
// 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 format.
function formatNSDate(dateObj){
if(dateObj){
@W3BGUY
W3BGUY / JitterBit_Check_For_Queued_Operations.txt
Created Sep 8, 2016
JitterBit Script to check for running operations. If operations are not currently running, start operation. This works very well when dealing with scheduled scripts that may overlap.
View JitterBit_Check_For_Queued_Operations.txt
<trans>
$isInQueue=GetOperationQueue("<TAG>Operations/OperationToCheck01</TAG>");
$isInQueue2=GetOperationQueue("<TAG>Operations/OperationToCheck02</TAG>");
$isRunning=$isInQueue[0][1];
$isRunning2=$isInQueue2[0][1];
if(($isRunning==1 && $isRunning!=Null()) || ($isRunning2==1 && $isRunning2!=Null()),
WriteToOperationLog("Skip for now: "+$isRunning+" / "+$isRunning2);,
WriteToOperationLog("Nothign is Running - Starting Operation Chain.");
RunOperation("<TAG>Operations/OperationToCheck01</TAG>");
);
@W3BGUY
W3BGUY / NS2.0_SCH_Set_Percent_Complete.js
Created Aug 22, 2016
NetSuite SuiteScript 2.0 - Set Scheduled Script Percent Complete
View NS2.0_SCH_Set_Percent_Complete.js
/**
* @NApiVersion 2.x
* @NScriptType ScheduledScript
* @NModuleScope SameAccount
*
* According to the documentation this is a read-only field. According to this working code and a verification from
* NetSuite tech support, the documentation is wrong. Hope this helps someone out.
*
*/
define(['N/runtime','N/record'],function(runtime,record){
@W3BGUY
W3BGUY / NS2.0_InventoryItemSearch.js
Created Jun 30, 2016
NetSuite SuiteScript 2.0 - Search for Inventory Items and return an array of all active items.
View NS2.0_InventoryItemSearch.js
require(['N/search','N/record'],function(search,record){
function buildItemArray(){
var itemArray=[];
searchItems();
itemArray=runSearch(itemArray);
deleteSearch();
log.debug(itemArray);
}
function searchItems(context){