ANS-1180 · CUSTOM FIELDS, RECORDS & FORMS

How to Add a Custom Button to a NetSuite Record Form Using a Formula Field

Learn to embed an interactive button on a NetSuite customer record form by leveraging a Formula (Text) field with HTML and JavaScript.

Short answer

A custom button can be displayed on a NetSuite record form by entering a specific HTML and JavaScript formula into a Formula (Text) field. This method creates a clickable image that opens a new window, linking to a specified NetSuite page or media file, offering a direct navigation shortcut.

Scenario

Users require a custom button on a NetSuite record form, such as a customer record, to provide quick access to related information or functions. This button needs to be visually integrated and, when clicked, should open a new NetSuite page or media file in a separate window.

Solution

To display a custom button on a NetSuite record form, a Formula (Text) field can be configured to embed HTML and JavaScript. While this method is functional, it is important to note that SuiteScript (User Event Scripts and Client Scripts) is the recommended and more robust approach for adding custom buttons and their associated logic in NetSuite's current interface and documentation.

  1. Create a new custom field on the desired record type (e.g., Customer).

  2. Set the field type to "Formula (Text)".

  3. Enter the following formula into the field:

'<a href"/app/common/entity/custjob.nl?cfX&ftENTITY&id' || {id} ||'&eT&lT" onclick"window.open(&apos;/app/common/entity/custjob.nl?cfX&ftENTITY&id'|| {id} || '&eT&lT&apos;, &apos;newwindow&apos;, &apos;width 0,height€0, left 0&apos;); return false;"><img src"http://shopping.sandbox.netsuite.com/core/media/media.nl?idB980&c@57631&h21ef537d122ffd13ea" alt"Setup Wizard" vertical-align: sub;style"width:120px;height:38.4px;margin:0px 0px"></a>'

This formula constructs an HTML anchor tag () containing an image (). The href attribute provides a fallback link, while the onclick attribute uses JavaScript to open a new window with a specified NetSuite URL. The tag references a media file stored in NetSuite's file cabinet to serve as the button's visual representation. The {id} field reference dynamically inserts the current record's internal ID into the URL, ensuring the link is specific to the record being viewed.