0
votes

I have been trying to get a alert in Netsuite for view mode but can't get it for customer record.

Though when I tried to get the alert for the edit record then I got it but I want it for view.

I tried client script, user event script and also workflow. But all support only for edit. Can I get the alert by any means for the view record option.

Thanks Gladiator

4

4 Answers

1
votes

One workaround that I've done is to add a custom field of type 'Inline HTML' to the customer form. Then during the beforeLoad event you can check if type == 'view' and update the custom field's value with the HTML that is needed to display the alert.

1
votes

Basically form.setScript used to work with SS1 but there was no (not hacked) API access to Netsuite's alerts

SS2.0 gives nice access to the alert system but it doesn't load in view mode unless you take a supported action (clicking a button)

See this answer for a sample with SS2 that loads your script and shows an integrated alert. SS2.0 Display Message on Record

1
votes

Thanks Mike, Michoel and Bknights. Here is the solution to the problem. Create an inline html field on the customer form. Since the field does not store value nlapiSetFieldValue for before load function works absolutely fine. Below is the snippet of the working code.

function before_load(type) 
{
    if (type == 'view') 
    {
        var pass_value = "<html><body><script type='text/javascript'>window.alert('Hello World!!!')</script></body></html>";
        nlapiSetFieldValue("custentity25", pass_value); //custentity25 is the id of Inline HTML field we created
    }
}

Note : The "" used should be different then the one used in the HTML code which is ''. If same are used then there will be an error.

0
votes

You need to use a User Event Script, and in the before load event, set a Client Script via form.setScript(). In your "injected" Client Script, you can display the alert.