This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<trans> | |
$contact_country=CASE( | |
$contact_countryShort=="AF","_afghanistan", | |
$contact_countryShort=="AX","_alandIslands", | |
$contact_countryShort=="AL","_albania", | |
$contact_countryShort=="DZ","_algeria", | |
$contact_countryShort=="AS","_americanSamoa", | |
$contact_countryShort=="AD","_andorra", | |
$contact_countryShort=="AO","_angola", | |
$contact_countryShort=="AI","_anguilla", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<trans> | |
thisState=case( | |
thisState=='Alabama','AL', | |
thisState=='Alaska','AK', | |
thisState=='Arizona','AZ', | |
thisState=='Arkansas','AR', | |
thisState=='California','CA', | |
thisState=='Colorado','CO', | |
thisState=='Connecticut','CT', | |
thisState=='Delaware','DE', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['N/search','N/record'],function(search,record){ | |
function buildItemArray(){ | |
var itemArray=[]; | |
searchItems(); | |
itemArray=runSearch(itemArray); | |
deleteSearch(); | |
log.debug(itemArray); | |
} | |
function searchItems(context){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>"); | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple way to remove all non-numeric characters from a string, in JitterBit | |
$phone=RegExReplace($phone,"(\\D)",""); |
OlderNewer