Tip 2 – Show any tab focused while loading a record in Netsuite

When a record is loaded, you always see the 1st tab is focused.
Have you ever tried to focus some other tab other than the default one or have you ever got such requirement?

Its not that difficult. We just need a simple User Event script for this on before page load event on desired record.

Let’s have a look on the code:

function FocusTabOnBeforeLoad(type, form, request){

//Always include the IF BLOCK, which restricts to load the page from infinite loading
if(request.getParameter(‘selectedtab’)==” || request.getParameter(‘selectedtab’)==null) {

//Create an array to store Tab Parameter with tab id
var selectedTabParams = new Array();

//”financial” is the Internal ID of “Financial” tab
//In this way you can add any tab ID as per your requirement
selectedTabParams [‘selectedtab’] = ‘financial’;

//Load the record again in ‘View’ mode with focused tab
if (type == ‘view’) {
nlapiSetRedirectURL(‘RECORD’, ‘customer’, nlapiGetRecordId(), ‘VIEW’, selectedTabParams );

//Load the record again in ‘Edit’ mode with focused tab
else if (type == ‘edit’) {
nlapiSetRedirectURL(‘RECORD’, ‘customer’, nlapiGetRecordId(), ‘EDIT’, selectedTabParams );


This is the user event script for customer record, which is responsible for focusing ‘Financial’ tab on page load event.
The type(edit/view) will be chosen as per the type that you have set in deployment.

Hope this small tip will help you.
This is my first tip on Suitescript. Hope will have more tips on scripting.