Change the focus to the item line in NetSuite

The following code can be used to change the focus to the body field in a record. We can add this code to the client script field change or pageinit if we need to change the focus to any specific field when loading the record or changing field value

 document.getElementById('field id of body field').focus();

The following code can be used to change the focus to a specific item line in a record. If the record has more item lines in the transaction record, and we have to change the focus to a specific item line when changing a field or loading a record, the following code can be added to the client script.

 // Line number is item line number
 var lineNum = lineNumber + 1;
 var fieldIdNumber = "custcol_jj_upc_code" + lineNum
           
 document.getElementById(fieldIdNumber).focus();

Leave a comment

Your email address will not be published. Required fields are marked *