How to Build Your SuiteApp for NetSuite

So you've been asked to create a SuiteApp...

Around 12 months ago, I began work on creating a SuiteApp for NetSuite (having had no previous NetSuite experience). While we are no strangers to creating integrations with 3rd party platforms here at Workiro, I was surprised to discover how powerful the SuiteCloud platform and SuiteCloud Development Framework were. It is much more akin to a SaaS platform, allowing you to create a complete application in a modern scripting language in an IDE, deploy that to an account via a CLI, and package up as an application in an app store!

It was quickly clear that the SuiteApp and SuiteCloud platforms were going to become a vital part of our strategic success, and therefore implementing a professional development process which would enable our team to build, test, deploy and ship our SuiteApp as quickly as possible, was vital.

This article details some of the tools and practices we have used, that have enabled us to create a process that we are familiar with as SaaS developers.

They break down to the following four suggestions - 

  • Use GitFlow
  • Use TypeScript
  • Swerve the IDE and use the CLI 
  • Don’t use CLI directly, Containerize!

Step 1. Use GitFlow

The great thing about SDF is that you are able to store your project locally and write the code on your machine. Any objects your project creates are stored as XML definitions, and as such can be stored in version control.

As a business, and coming from a web development background, we were already very familiar with this idea. We use git and were used to the typical “GitHub-flow” branching strategy.  But while this strategy is great for a continuously updating project such as a web app, it’s not so great a fit for when you’d like to release (and support) a specific version of your software, such as a SuiteApp. So my first suggestion would be to read up on, and adopt, “Gitflow” branching strategy before doing anything else.   

Step 2. Use TypeScript

I began by following the SuiteScript “Hello World” guide (very helpful, I would advise!) which demonstrates how to deploy your first SuiteScript using SDF. NetSuite’s JavaScript API allows you to create and compose scripts based on the AMD module format. The most recent version (2.1 at time of writing) introduces some of the, now commonplace, features of JavaScript such as `const` and `let` keywords and arrow functions etc. 

But having written a complex React-based web app using TypeScript, I was keen to work out whether it would be possible to bring the many benefits to our SuiteApp - these included static typing, access to ES2019 features, and great tooling support. 

The thing is, using an external API can be tricky with TypeScript unless someone provides the types.

Fortunately, “Head in the Cloud” development company has gone to the trouble of defining the types for the SuiteScript API - see here. Once installed and configured (given you are using a TypeScript-aware IDE) you’ll benefit from syntax highlighting, error detection, embedded API docs, type-checking, and autocomplete for all of the SuiteScript 2.x modules and types. You can find the clearly defined installation instructions here.


Step 3. Swerve the IDE plugin and use the CLI

Although there is a plugin for JetBrains WebStorm, I would suggest using VS Code and the terminal (using the CLI). This seems to be an industry-wide preference of forgoing clunky “plugins” in favour of lightweight command-line tools.

The additional benefit is that once you’ve understood the process of deploying your new project via the CLI, you’ll be nearer to being able to automate the process via a CI/CD pipeline (blog post on this coming soon!). 

Step 4. Don't use the CLI directly, Containerize!

Getting the dependancies installed on your machine (Node and JDK 14 etc) to use CLI is simple enough, however when your team mate then downloads the latest version of Node rather than the version that is required, the problems begin. Then there’s the build machine so that you can automate building and deployment. This all creates unnecessary work for your team mates and DevOps team.

Docker makes it possible to standardise the way in which software is run (think, the operating system and other bits of software or settings that are required) by defining a container so that it can run anywhere.   

Containerization is the next logical step toward reducing version conflicts and saving time. Containers package all binaries and their dependencies into one executable image. This means, if you need to use a more recent version of Node on your host machine, you can have a container running Node 16 LTS without any conflicts. 

I found this article from ERP and distributed systems expert, Brendan Boyd, very helpful - “Using containers for the your netsuite dev workflow”.

I hope this helps! 

Keep reading:

How to Build Your SuiteApp for NetSuite

Our Head of Development, Keir, gives his advice for when it comes to building your own SuiteApp for NetSuite.

Who is Workiro For?

Workiro is a next-generation app made for work. It uniquely combines document management, task management, communication and e-signatures all together in one handy place. To put it simply, we make your life easier. But who can, and should, use Workiro? Find out in this short blog post.

A Love Story Between a Finance Team and Ultimate Control

Discover how the Workiro NetSuite integration helped a finance team to maintain robust processes and provide the strongest possible control environment - all whilst providing great flexibility and visibility.