Skip to content

Instantly share code, notes, and snippets.

View michoelchaikin's full-sized avatar

Michoel Chaikin michoelchaikin

View GitHub Profile
@michoelchaikin
michoelchaikin / python_suiteql.py
Created June 22, 2021 00:16
Run NetSuite SuiteQL queries using REST API in python
import requests
import json
import pandas as pd
import os
from oauthlib import oauth1
from requests_oauthlib import OAuth1Session
def parse_suiteql_response(response):
response_json = json.loads(response.text)
@michoelchaikin
michoelchaikin / findAnalyticsTable.js
Last active October 28, 2020 22:49
NetSuite Script to help identifying which Analytics tables a record is stored in
/**
* A script to help identifying which Analytics tables a record is stored in.
*
* It works by retrieving the count for every table in the account and saving that to browser local storage
* The next time the script is run, it will compare the current count for each table, and identify any tables
* that have changed.
*
* USAGE:
*
* This script is intended to be copied and pasted into browser dev console. I recommend using the Chrome Snippets Feature
/**
* Usually if you want to access the SuiteScript 2 API via the browser console you need to open specific pages
* that load the required libraries (such as a record in edit mode). This script will load the libraries on any
* NetSuite page
*/
(async () => {
/* Add a script element to the DOM and wait until it's loading by checking that
a known variable it creates exists */
@michoelchaikin
michoelchaikin / invoiceWithGroups.xml
Created February 9, 2020 09:44
NetSuite Advanced PDF/HTML Invoice Template with the products grouped by class
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
@michoelchaikin
michoelchaikin / mos_product_search.html
Created March 8, 2018 22:11
Product Search Suitelet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/r/zf-5.5.2/jq-2.1.4,dt-1.10.9/datatables.min.css"/>
<script type="text/javascript"
src="https://cdn.datatables.net/r/zf-5.5.2/jq-2.1.4,dt-1.10.9/datatables.min.js"></script>
@michoelchaikin
michoelchaikin / postmanNetSuiteTBA.js
Last active December 23, 2023 19:06
Postman pre-request script to generate TBA variables for NetSuite Web Services
/*
Usage:
1. Define a NetSuite environment in Postman (https://www.getpostman.com/docs/postman/environments_and_globals/manage_environments)
with the following keys set: account, consumerKey, consumerSecret, tokenId, tokenSecret
2. Add this script to your "Pre Request Script" in Postman (https://www.getpostman.com/docs/postman/scripts/pre_request_scripts)
3. Add the Token Passport in your request with variable placeholders
@michoelchaikin
michoelchaikin / mos_lookup_history_cs.js
Last active December 7, 2018 20:56
Lookup History Netsuite Customization
/**
* Client side code for Lookup History customization
*
* Script Type: Client Script
* Deployed to: <not deployed>
*
*/
'use strict';
@michoelchaikin
michoelchaikin / gulpfile.js
Last active July 26, 2017 21:19
Gulpfile for Netsuite development
const gulp = require('gulp');
const typescript = require('gulp-typescript');
const del = require('del');
const keepass = require('keepass-http-client');
const spawn = require('child-process-promise').spawn;
const open = require('open');
const PROJECT_NAME = 'XXXX';
const PROJECT_URL = 'https://system.sandbox.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=XXXX';
const SDF_CLASSPATH = 'C:\\Users\\michoel\\Desktop\\sdf\\\*';

MAIL TO PRINTER GATEWAY

sudo adduser autoprint
sudo apt-get install fetchmail postfix

/etc/default/fetchmail

START_DAEMON=yes
@michoelchaikin
michoelchaikin / printlabels.js
Created August 18, 2016 23:58
Netsuite Advanced PDF/HTML templates for any record type
/**
* Add 'Print Item Labels' button to Item Page
*
* Script ID: customscript_mos_itemlabels_ue
* Script Type: User Event
* Deployed to: Inventory Item
*
*/
function beforeload(type, form) {