Netsuite,如何在登录netsuite 帐户后显示弹出窗口?

0 netsuite

我是 Netsuite 的新手,我需要在用户登录 Netsuite 帐户后显示一条显示“welcomeuser”的警报消息。

我已经尝试过这个客户端脚本,但它没有显示任何消息。

function employee_PageInit(type){
    debugger;

    alert('Dear UserName, The data in NetSuite is confidential and the property of the company.');

    nlapiLogExecution('DEBUG', 'user role', nlapiGetContext().getName());
    alert('ok'+ nlapiGetContext().getName());
}
Run Code Online (Sandbox Code Playgroud)

我已使用 ADMINISTRATOR 角色登录,

感谢您提供任何帮助。

小智 6

这是一个带有 2.0 的示例。它不漂亮,需要一些工作。但这是使用 portlet 将 javascript 逻辑注入主页的一种方法。

/**
 *@NApiVersion 2.x
 *@NScriptType Portlet
 */
define(['N/runtime'],
    function(runtime) {
        function render(params) {
            var user = runtime.getCurrentUser();
            params.portlet.title = 'Welcome Message';
            var content = '<script>alert(\'Hello ' + user.name + '\');</script>';
            params.portlet.html = content;
        }
        return {
            render: render
        };
    });
Run Code Online (Sandbox Code Playgroud)