Harsh
Harsh

Reputation: 47

How to call suitelet at PageInit function of Client in NetSuite

Please let me know how to call suitelet at PageInit function of Client in NetSuite. I tried this in Page Init function of Client:

var var_url_servlet = nlapiResolveURL('SUITELET','customscript_sl_addressvalidation','customdeploy_sl_addressvalidation', false);

I have inserted logs in Suitelet. But calling this method in Client. I can't see any logs. Please help.

Upvotes: 0

Views: 3231

Answers (1)

prasun
prasun

Reputation: 7343

Your code is just resolving the url, add another statement to make AJAX.

var var_url_servlet = nlapiResolveURL('SUITELET','customscript_sl_addressvalidation','customdeploy_sl_addressvalidation', false);
//to send synchronous ajax, To make async add callback param
var response = nlapiRequestURL(var_url_servlet);

Also, for logging use browser's console APIs eg: console.log() instead of nlapiLogExecution(), and see the logs directly in browser's console for logs that are in context of client script

Upvotes: 3

Related Questions