October 26, 2020

enum Example

A reader asked for more detail on exactly how I leverage enumerations, so I thought I’d give a more explicit example.

An enumeration module is no different than any other custom module you would build, and it outputs a plain JavaScript Object, like so:

That is the enumeration module in its entirety. The structure is a plain JavaScript Object, so you can add as many properties as you want, and those properties can refer to numbers, strings, Arrays, other Objects, etc.

If I want to then reference that Printful property within, for example, a User Event script in the same directory as my-enums.js, it looks like this:

While I would prefer enum over enums, be aware that enum is unfortunately a reserved keyword in JavaScript, and so cannot be used as a variable name.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Related posts

March 3, 2021

Does the physical location of a competent employee change the amount of value they can deliver for your organization? If it does, I’d be keen to hear your story. If it does not, why ...

Read More

March 2, 2021

Today a friend and former colleague of mine – who happens to now be in a development leadership role for a NetSuite partner – was lamenting the extreme difficulty of finding and hiring NetSuite ...

Read More

March 1, 2021

Software is never finished; clients are always changing and re-prioritizing. NetSuite is ever a moving target – always updating and evolving. Market forces are always shifting and shoving, forcing new demands on your business. ...

Read More