When users use form.addbutton on a beforeload of a user event script, the onClick function of the button must be on a separate client side script.
Example:
I. User Event Script
function beforeLoad(type, form)
{
form.setScript(XX) //XX is the Client side script id
form.addButton('custpagetestbutton', 'TEST button', 'customScript();');
}
II. Client Side Script > id = XX
function customScript()
{
nlapiLogExecution('DEBUG', 'script', 'runs');
}
Note: if the user places the customScript() function on the same user event script, the log execution will run without clicking the button.
No comments:
Post a Comment