Topic

SuiteScript

Practical NetSuite scripting and saved-search notes.

Javascript Equivalent of Common Financial Formulas Found In Google Sheets

Continuing my work on RTU assets from yesterday, I found I needed to program some of the common formulas you see in Google Sheets into Javascript to be used in my Suitescript code. These common functions include: PV(rate, number periods, payment amount, future value, end or beginning) FV(rate, number periods, payment amount, present value, end or beginning) PMT(rate, number periods, present value, future value, end or beginning) Each of the…

Read guide

Can't Find altemail In Saved Search Filter

Why can’t you search for altemail in a Saved Search filter? Whether you’re coding using SuiteScript or just using the Saved Search feature in Netsuite you might find it difficult to use the altemail field in Netsuite, as it doesn’t exist as a search feature in the Filter section of Netsuite’s documentation. So how do you search for this email address for your Individual Customer records where this field is…

Read guide

SuiteScript Change On Credit Hold Field On Customer Record

How do you change the Hold field found on the customer record using SuiteScript? The Hold field in a Customer record prevents users or the customer from having any new Sales Orders being placed and has three settings On , Off and Auto . The code name of the field is creditholdoverride . To set the value for this field using SuiteScript, enter the value in all capital letters according…

Read guide

How To Create A Radio Button In Suitelet Form

How do you create a radio button in a Suitelet form? To create a series of radio button elements in a Suitelet form you need to add each element of the radio series as distinct fields using the .addField function. The id property needs to be the same for each radio field and the source property needs to be unique for each element. Here’s an example demonstrating what this would…

Read guide

NetSuite RESTlet Example (OAuth1): Send File Using Python

How do you send a file through to your NetSuite instance via a RESTlet using a Python Script? If you know how to send a POST request through to a RESTlet using Python then only minor modifications need to be made to enable the sending of a file. One reason why you may prefer sending a file for NetSuite process is where you have a lot of data to consume…

Read guide

NetSuite RESTlet Example (OAuth1): Python Script To RESTlet

How do you send data to your NetSuite RESTlet using Python? To send data to your NetSuite RESTlet using Python code utilise the handy requests oauthlib library. If you need to upload a series of CSV files and want to perform some data cleaning before being uploaded and want to avoid the Import CSV process then you can create a simple RESTlet and insert your clean data directly. Create Your…

Read guide

How To Use FORMULA In Filter Expression - SuiteScript 2.0

I had recently had to use a FORMULA type in a SuiteScript 2.0 search and found it as a very useful filter for list values. To use FORMULA types in a filter expression, such as, FORMULATEXT , FORMULAPERCENT , FORMULANUMERIC , FORMULACURRENCY or FORMULADATETIME just prefix the type of FORMULA at the beginning of your filter expression and then write your formula. Use the operator and value as you normally…

Read guide

SuiteScript UNEXPECTED_ERROR With RESTlet

A recent project hit a roadblock when I changed some code depending on the N/search module and refactored it to use N/query module. While I had some initial hassles with accepting the Beta nature of the N/query script I soon ran into another error once I had got the code to a level I knew would work: Great. Another helpful SuiteScript error. This one took some time to diagnose, but…

Read guide

Best Set Up For SuiteScript Coding in WebStorm

As mentioned in my previous post on what my preferred text editor is for SuiteScripting NetSuite does provide a deeper integration with JetBrains’ WebStorm product through a plugin. To enable this plugin in WebStorm you will need to access this help page in NetSuite’s documentation and follow the step by step guide. (The process is fairly straightforward, but unfortunately the plugin doesn’t play well with PyCharm.) Once you then have…

Read guide

Best Editor For Coding SuiteScript Seamlessly

If you’re looking for a good text editor to perform your SuiteScript coding there are good editors, such as Microsoft’s Visual Studio Code, but the one I personally use on a regular basis is PyCharm. Both platforms enable you to: Write and analyse your JavaScript code; Have integrated terminal and console windows; Git integration; Ability to code in other languages, such as Python (great for web-scraping and data analysis of…

Read guide

How To Print More Than 1 Page In Advanced PDF/HTML Templates

I like NetSuite’s Advanced PDF/HTML templating system with the FreeMarker syntax. However, there are a couple of issues I’ve run into and one just recently: How can you force printing on two or more pages? One example I’ve been working on is the ability to print “how to pay” information on the back of our invoices that are issued to our customers. As our invoices can span a few lines…

Read guide