Top-Tier NetSuite Partner Protelo is here to help. Call Us Today! 916-235-8601
    NetSuite-blog

    NetSuite Blog

    Adding Client Scripts on “View” of Record

    Adding Client Scripts on “View” of Record

    Is there something you would like to change on page record displayed differently, but don’t want to re-write the entire record page into a Suitelet?

    Do you want to customize a record to provide for a better user experience? It can be done with a few easy steps. Follow this guide to get around gaps in NetSuite’s features and make NetSuite work more efficiently for your business processes.

    Client scripts can be used for a multitude of different features, but what if you want a client script to execute on the “view” of record?

     

    Why execute a client script when viewing a record?

    The quick answer is to add features not officially supported by NetSuite. Code from client scripts is injected directly into the page. With some creativity, this allows for some nice UI improvements such as highlighting lines in child records, redirecting to another page, or better loading modals.

     

    Adding the script

    Unfortunately, the standard method of deploying a client script via the NetSuite interface will not work for “view” types. Instead, a user event script’s form argument is used to manually attach the client script.

    1. Create a new client script record like normal, but do not create any deployments.

    2. Create a user event script following the example below.

    Adding Client Scripts
     

    Replace customscript_my_script_id with the actual ID of the client script created in the first step.

    3. Create a user event record in NetSuite following the usual procedure.

    4. Deploy the UE script to any record types that you want the corresponding client script to be on.

    That’s it! The client script will now be included when viewing the selected records.

     

    There are a few limitations.

    The usual nlapiGetFieldValue and similar functions are unavailable. Instead, you will need to either load the record or use nlapiLookupField in conjunction with nlapiGetRecordId.

    Another problem, the usual call to the defined page init function will not fire. Instead, include the standard jQuery on ready function in your client script file.


    Adding NetSuite script

     

    Written by: Eddie Atter, Senior Technology Consultant

     

     

    Need help with NetSuite?

    If you're feeling stuck or unsure about tackling a NetSuite customization, why not chat with one of our experts before diving in? At Protelo, we're here to support you every step of the way, whether you have a quick query or a more intricate issue to resolve. Our team of seasoned business consultants is primed and ready to provide tailored solutions to meet your needs. Don't hesitate to reach out – we're here to ensure your NetSuite experience is seamless and successful.

     
     

    For more information about our NetSuite Services contact our team today!

    Contact NetSuite Experts Today

    Our Latest Blogs

    Free NetSuite Product Tour

    Learn more about the worlds #1 Cloud ERP. Protelo’s award-winning NetSuite experts are here for your business.
    LiveChat our team, submit a form or call us today.

    Contact Protelo Today

    Subscribe To Our Blog