SuiteScript Function Naming

Over time, everyone builds their own style of programming. A lot of that style is defined by your past experience, where and how you learn a particular concept, the context in which the code is being written and your goals when writing that code. There are many styles of programming and I would not consider any of them to be right or wrong because there are pros and cons to each way of getting the job done.

When writing scripts for NetSuite there are a few things to keep in mind. What do I name my function? When is the script going to execute? What is the script going to do? Let’s talk about naming our functions.
Read more

map() your NetSuite Search Results

Almost every script that I write for NetSuite performs a search for some kind of data. You can accomplish this easily with SuiteScript by using either nlapiLoadSearch(), which will run an existing saved search and return the results, or nlapiSearchRecord(), which is used to build your saved search in code.

I prefer the latter option since the script does not have the external dependency on the saved search. If anyone were to change or delete that search, the script may no longer perform as expected. Also, by defining the search within the script itself the search logic can be stored in your source code repository.

Both of these functions return an array of nlobjSearchResult. but these objects can be cumbersome to work with and frequently calling getValue() or getText() can introduce a bit of noise into your code making it more difficult to read. I prefer to take these results and convert them into an an array of standard Javascript objects. This can make your search results easier to work with. Fortunately, the Javascript map() function works perfectly for this scenario.  The map() function executes a callback function for each element in an array and creates a new array from the results of the callback function.

Read more

On Working Remotely

For the last 23 years, I’ve worked in a corporate environment in either an office or cubicle. Working in Information Technology, it’s important to be in close contact with your customers, the people that use the technology you deploy to perform their day to day jobs. Occasionally, when I needed some heads-down time, I would work at home to limit interruptions or to focus on a particular project. These days were highly productive and I was always glad that my employer gave me the opportunity to do this from time to time.

In August of 2014, I needed to move half-way across the country and my employer was gracious enough to allow me to keep my job and work from home full time. I was really looking forward to the ability to have that same level of focus and productivity all the time. As someone who has been striving for ways to reduce expenses in my personal life, I was sure this was the best thing for me. An opportunity to work in an environment of ultimate productivity and save an immense amount of money by eliminating my daily commute. But things weren’t as awesome as I had hoped.

Read more

Pluralsight, Training for Serious Learners

Pluralsight is an online training web site offering courses in just about any kind of technology you can think of at all different experience levels. These courses are made by leaders in the community. Names that you’d recognize from popular commercial and open source development houses. They contain high quality content about technologies that are relevant today. So many new courses are added each week that I find I’m adding new courses faster than I can watch everything in my to do list. It’s a good problem to have.

Read more

Nested Drop Down Lists in NetSuite

Data accuracy should be a top priority in any system-related project and preventing users from entering data that doesn’t make sense will make designing processes and reports much easier. When categorizing objects in many applications, it’s common to use drop down lists for fields such as Category and Sub-Category to help identify objects in reports. By using nested drop down lists, you can ensure that the selected Sub-Categories are relevant to the selected Category. Nested drop down fields can be easily created in NetSuite’¦it’s just not immediately obvious because you’ll need to use custom records rather than custom lists.

Read more