How To Trigger Field Change On Click Of Mark All Button?

The Field Change Event in client script triggers on change of values in any field in the UI. But when you change the field values using buttons like mark all or add multiple, the client script doesn't trigger. Netsuite suggests to write a user event script to do this validation. But there are many scenarios where the validation has to be performed in field changed function and it can't be replaced by User Event Function. We have designed an alternative method for this scenario:

First use inspect element on the mark all button and get it's id. Let the id be 'markall' for this example. On the client page init, write the below code (change the internal id based on your record):

document.getElementById("markall").onclick = function() {markall();};

function markall() {

var count = nlapiGetLineItemCount('payment');

for(var i=1;i<=count;i++)
{

      nlapiSelectLineItem('payment', i);
      
      nlapiSetCurrentLineItemValue('payment', 'apply', 'T', true, false);
}
    
}

Now, client field change function will be triggered when you click on mark all button. Similarly you can write code for unmark all button.



For Netsuite Training (Including training for interviews), Support, Implementation contact us at:


Email : netsuiteacademy@netsuite-academy.com


Facebook page : https://www.facebook.com/Netsuite-Academy-1591053827660082/


Comments

  1. We are NetSuite Solution Provider with vast experience in NetSuite Implementation, netsuite customization including netsuite training & netsuite integration.
    NetSuite Solution Provider
    NetSuite Training
    NetSuite Implementation
    NetSuite Customization
    NetSuite Integration

    ReplyDelete

Post a Comment

Popular posts from this blog

Work Around the 1000 Row Limit Returned by Saved Searches in Netsuite

Understand Core Technology behind SuiteScript 2.0

HOW TO SET SUBLIST SUB RECORD VALUES IN SUITE SCRIPT 1.0 AND 2.0