我是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());
}
我已登录角色ADMINISTRATOR,
任何帮助表示赞赏谢谢。
这是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
};
});
我过去一直在努力解决这个问题,你想要什么在技术上是不可能的,因为在你查看主页时没有运行的脚本。以下是一些奇怪的解决方法:
您可以尝试使用它在仪表板中突出显示内容的自定义portlet。然后也无法提醒。
你可以写一个函数
function pageInit(type){
var context= nlapiGetContext();
var username = context.getName();
alert(hello+username);
}