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 / NetSuite_DueDateCalculation.js
Last active August 6, 2020 14:50
Simple function to calculate the due date based on an invoice date and terms ID.
function calculateDueDate(termID,invDate){
var dueDate=''
try{
var daysToAdd=search.lookupFields({type:'term',id:termID,columns:['daysuntilnetdue']}).daysuntilnetdue;
dueDate=new Date(format.parse({value:invDate,type:format.Type.DATE}));
dueDate.setDate(dueDate.getDate()+parseInt(daysToAdd));
}catch(err01){
log.error('calculateDueDate.err01',JSON.stringify(err01));
handleErrorAndSendNotification(err01,'calculateDueDate');
}finally{
@W3BGUY
W3BGUY / Wifi Password List
Created August 16, 2020 14:33
List of random passwords that I've gathered
Gloria's Cafe
- I Love Gloria's
- iloveglorias
Austin Oral (on 1)
- AOS-GUEST
- aos-guest
Dozen Street
- The Doz
@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 / Jitterbit_PowerShell.ps
Created November 25, 2020 14:10
Call a Powershell command from within Jitterbit
// Author - Danial Fields
$command = "cmd";
$arguments = '/c powershell -ExecutionPolicy ByPass -File "C:\\directory\\RunCommand Test.ps1" -p1 ' + $p1 + ' -p2 ' + $p2 + ' -p3 '+ $p3 + '"';
@W3BGUY
W3BGUY / Jitterbit PostgreSQL Info.sh
Last active March 31, 2021 21:15
Jitterbit PostgreSQL Info
# Connect to PostgreSQL from Linux
/opt/jitterbit/pgsql/bin/psql -d postgres -U jitterbit -p 46914
# List databases
\l
# list tables
\dt
# Connect to TranDb database
@W3BGUY
W3BGUY / NetSuite_Convert_Date_Obj_To_NS_Date.js
Last active April 21, 2021 15:10
NetSuite - Convert Date Object into NetSuite usable Date 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 format.
function formatNSDate(dateObj){
if(dateObj){
@W3BGUY
W3BGUY / NetSuite_GetItemType.js
Created June 7, 2021 11:41
Simply function to get any item type by internal ID. Adding this since I've seen multiple questions about how to do it.
function getItemType(itemID){
var itemData={};
try{
itemData=search.lookupFields({type:search.Type.ITEM,id:itemID,columns:['type','externalid','price','displayname']});
log.debug('itemData',JSON.stringify(itemData));
}catch(err01){
log.error('getItemType('+itemID+').err01',JSON.stringify(err01));
}finally{
return itemData;
}
@W3BGUY
W3BGUY / country_ISO3166-1_to_NetSuite.txt
Last active November 10, 2021 16:54
#Jitterbit #Country Codes Conversion - #ISO3166-1 Alpha-2 format to #NetSuite format
$countryCodeDict=Dict();
AddToDict('countryCodeDict','AF','_afghanistan');
AddToDict('countryCodeDict','AX','_alandIslands');
AddToDict('countryCodeDict','AL','_albania');
AddToDict('countryCodeDict','DZ','_algeria');
AddToDict('countryCodeDict','AS','_americanSamoa');
AddToDict('countryCodeDict','AD','_andorra');
AddToDict('countryCodeDict','AO','_angola');
AddToDict('countryCodeDict','AI','_anguilla');
AddToDict('countryCodeDict','AQ','_antarctica');
@W3BGUY
W3BGUY / Jitterbit_PostgreSQL_Update
Last active August 19, 2022 14:49
Updates to improve PostgreSQL performance.
Add to Jitterbit.conf file
[LogSync]
# Max number of records at once to sync - This is the initial batch size only! After retries it goes
#back to MinRecordsToSync!
MaxRecordsToSync=500
#Max sleep between retries
MaxRetryDelaySec=60
#It's actually the maximum after retries have kicked in!
MinRecordsToSync=500