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

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

In netsuite customization ,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:
As a netsuite solution provider we suggest

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.

Feel free to reach out TheSmilingCoders for proper netsuite implementationnetsuite consultation , netsuite customization, netsuite Support,netsuite Training contact us at:

Email : [email protected]

Facebook : https://www.facebook.com/Smiling-Coders-Netsuite-Training-Implementation-and-Support-1591053827660082/

Linkedin : https://www.linkedin.com/company/netsuite-academy/


Log out of this account

Leave a Reply