Add a Button in NetSuite to Print the Unprintable

This article outlines a SuiteScript design pattern used to add a button to a transaction, entity or other scriptable page in Oracle NetSuite ERP. This article has an example button action to print something completely custom.

...
Jack Ring
Share:

A Business Case

Our clients entrust us to help determine feasibility, offer expert advice, and options to stay as native as possible. We take that responsibility very seriously and do as much diligence as possible before executing on any account customization.

NetSuite offers a few options for transferring inventory. We typically advise that the one-step Inventory Transfer transaction be reserved for the Finance team to decrease items in a source location and increase them in a receiving location, all in one step. Although the Transfer Order transaction does the same thing, we advise Transfer Orders be used in all other cases because they enable you to track items in transit between two locations. They are also useful in scheduling and tracking the steps of the process.

One of our clients came to us with a requirement to print a custom PDF for an Inventory Transfer transaction. This is one of those records for which, to date, NetSuite does not offer a print option. We overcame this challenge by utilizing SuiteScript. We built a (1) User Event script, (2) Client Script, (3) Suitelet and an (4) PDF / HTML file to do the job. The following is not intended to be a lesson in suitescript theory or otherwise. It's meant to serve as a general outline and comes with no promises or guarantees.

(1) Build the User Event Script

...

The user event script shown will add a button to the page. You must also create the user event script record within NetSuite. Line 15 attaches the client script to the form. No script record is required for the client script.

(2) Build the Client Script

...

Line 21 is the url path to the Suitelet script deployment. The function is meant to fire an HTTP GET request to our suitelet with the record internal ID as a single parameter.

(3) Build the Suitelet Script

...

  • Line 17 get parameter internal ID for the Inventory Transfer record.
  • Line 18-19 Load the data (we organize our code to use dao library)
  • Line 21 Read the contents of the layout PDF / HTML file shown in the next section "(4) Build PDF / HTML File".
  • Line 23-24 Add the tempalate and the data object to an instance of a renderer module.
  • Line 30-32 Throw the resulting file data into a new browser tab and instruct the browser to treat it as a PDF file.

(4) Build PDF / HTML File

...

We choose to save the file with an XML extension in the SuiteScripts folder in the file cabinet.

The Final PDF Output

...

In this example we used the addition of a button to allow user feedback to the system. In this case the feedback was simply, build me a PDF. We could have grabbed data from absolutely anywhere in the system or beyond. We could have added charts, graphs and probably anything else you could have imagined.

If you need help doing more with your NetSuite instance, give us a call. We're here to be your NetSuite system experts. This way you can remain focused on the needs of your customers and growing your business.



Schedule a Conversation

Let's talk. • (724) 816-1000 • info@leftledger.com


Latest Stories

Here's what we've been up to recently.





Join our mailing list

From us to your inbox.



Schedule a Conversation

Let's talk. • (724) 816-1000 • info@leftledger.com