ALERT IN NETSUITE USING USER EVENT BEFORE LOAD SCRIPT

HOW TO THROW ALERT FROM USER EVENT BEFORE LOAD SCRIPT?

It is a well known fact that alert can be thrown from client script by directly using alert() method. But lot of times developer needs to use user event script as client script has several limitations like not being able to run as admin. It always runs the script using the logged in user’s role. Client script also doesn’t get triggered when you view a record. It gets triggered only on edit, create and copy.

Feel free to reach out netsuite solution providernetsuite implementationnetsuite consultation , netsuite customizationnetsuite Support, netsuite Training 

Alert can be thrown from user event script by using a mix of  html code with Netsuite API. So, first you will to create a custom field of type inline html. Label is not required for this field. This field can be created using form object in the before load function.

Then we can set an html alert in that field as default value. The code snippet is given below

function UE_BeforeLoad(type, form, request)

{


            var alert_value = “<html><body><script type=’text/javascript’>window.alert(‘HELLO..UE ALERT’)</script></body></html>”;
    
            var field = form.addField(‘custpage_alertfield’ ,  ‘inlinehtml’);
    
    
            field.setDefaultValue(alert_value);
    
     
}

contact us at:

Email : info@smilingcoders.com

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

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


Leave a Reply