Learn how to Hide NetSuite Sublist Buttons and Other HTML Elements

This article is relevant if you want to hide some buttons and other HTML elements on NetSuite forms.

Background

NetSuite’s point-and-click customization system is generally good for giving administrators the ability to change the NetSuite presentation layer. However, recently, a client came to us asking a simple question:

"How can I remove the buttons on the Invoice > Communication Sub Tab?  I want to remove:
Attach
Letter
PDF
Fax
Customize View"


Fortunately, I have experienced members on our team that have strong fundamental web and database development skills. Thus, they know how to answer these kinds of questions.

These specific sublist buttons are not available for removal via the point-and-click customization. You often can hide the entire tab — but many times, that is not what we want to do. We just need more refined control over the situation.

How to Hide NetSuite User Interface Elements

While NetSuite does not recommend you modify the user interface without using its built-in tools and libraries, there are times when we must take matters into our own hands. We must always remember that the NetSuite client presentation layer is (complex) HTML and thus we can use client-side JavasScript to get control. This kind of browser programming is called Document Object Model (DOM) which provides the API layer to make HTML interactive. As such, all we need to is know a few key things:

  1. JQuery: NetSuite provides a reference to the JQuery add-in library by default. Thus it is convenient for DOM operations.
  2. HTML IDs: We need to know the IDs of the target HTML elements we want to manipulate.
  3. Script: We need to inject some client-side JavaScript into the HTML to get ultimate control.

Click on related images to learn how to discover the names of the buttons that you want to hide.

NetSuite Client Side 2.0 Script to Hide Buttons

Below is a NetSuite beforeLoad script to create a hidden HTML field that allows you to inject client-side JavaScript that will then find the buttons and use CSS to change the visibility to hidden via JQuery.

//create an inline html field
var hideFld = context.form.addField({
	id:'custpage_hide_buttons',
	label:'not shown - hidden',
	type: serverWidget.FieldType.INLINEHTML
});

 
//for every button you want to hide, modify the scr += line
var scr = "";
scr += 'jQuery("#print").hide();';
scr += 'jQuery("#addmessage").hide();';
scr += 'jQuery("#addcontact").hide();';

//push the script into the field so that it fires and does its handy work
hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>"

Get Expert NetSuite Customization Help

In my mind, one of the major reasons NetSuite is so valuable is that we can enhance the system to address our business concerns. Even if NetSuite does not expose every business element for manipulation, there is sufficient room to be creative to “get the job done”. If you have a NetSuite challenge and you need strong professionals who will listen, understand, invent and deliver on innovations, let’s have a conversation.

Be Sociable, Share!

Marty Zigman

Holding all three official certifications, Marty is Southern California's NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 25 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - Google Plus - YouTube

| Category: NetSuite, Technical | Leave a comment

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>