Monday, October 8, 2018

Set Focus to a Subtab in View/Edit Mode on Page Redirect

Sample code demonstrates how to set focus to a subtab in view/edit mode on page redirect. Create a user event script on before load function, deploy on the record and use nlapiSetRedirectURL.
 
function onBeforeLoad(type, form, request)
{
  if (request.getParameter('selectedtab') == '' || request.getParameter('selectedtab') == null) {
    var selectedTabParam = new Array();
    selectedTabParam['selectedtab'] = 'custom';
    if (type == 'view') {
      nlapiSetRedirectURL('RECORD', 'itemfulfillment', nlapiGetRecordId(), 'VIEW', selectedTabParam);
    }
    else 
    if (type == 'edit') {
      nlapiSetRedirectURL('RECORD', 'itemfulfillment', nlapiGetRecordId(), 'EDIT', selectedTabParam);
    }
  }
}

 
 

No comments:

Post a Comment