我正在使用2个脚本在NetSuite中完成电子邮件功能。我有一个用户事件脚本,它创建一个按钮,一个客户端脚本,该脚本提取所有需要的变量,并根据在“销售团队”子列表中找到的值来运行电子邮件。这是我的问题:在测试脚本时,一切工作都很好,因为我正在以管理员角色进行测试(我知道是菜鸟错误)。当管理员以外的其他角色尝试通过单击按钮运行脚本时,由于角色权限问题(无法提取存储电子邮件地址的员工数据)而引发nlObjError。是否可以在UE脚本中提取我需要的所有变量(可以以Admin身份执行)并将它们传递给客户端脚本?
UE脚本:
function userEventCreateButton(type, form, request){
if (type != 'edit'){
return;
}
form.addButton('custpage_RequestSOW', "Request SOW", 'cs_RequestEmail()');
form.setScript('customscript224');
Run Code Online (Sandbox Code Playgroud)
客户端脚本:
...for (var y = 1; y <= nlapiGetLineItemCount('salesteam'); y++) {
var z = nlapiGetLineItemValue('salesteam', 'salesrole', y);
nlapiLogExecution('DEBUG', 'sales role', z);
var user = nlapiGetUser();
**var username = nlapiLoadRecord('employee', user);**
var firstname = username.getFieldValue('firstname');
var lastname = username.getFieldValue('lastname');
var opptitle = nlapiGetFieldValue('title');
var customer = nlapiGetFieldValue('customer');
nlapiLogExecution('debug', 'user', user);
if (z != 5){}
else if (z == 5){
var employee_name = nlapiGetLineItemValue('salesteam', 'employee', …Run Code Online (Sandbox Code Playgroud) 有谁知道或有一个我可以用于SS2.0的JSDOC定义库?
我对SS1.0的当前版本如下所示,我用它来插入我的IDE并获得自动完成功能.
/** * Loads an existing saved search. The saved search could have been created using the UI, or created using nlapiCreateSearch(type, filters, columns) in conjunction with nlobjSearch.saveSearch(title, scriptId).
*<br>API Governance: 5
* @param {String} recType [optional] - The record internal ID of the record type you are searching (for example, customer|lead|prospect|partner|vendor|contact). This parameter is case-insensitive.
* @param {String} searchId - The internal ID or script ID of the saved search. The script ID of the saved search is …Run Code Online (Sandbox Code Playgroud) 我们在NetSuite中附加了一个销售订单的用户事件脚本,但是我们注意到只调用了context.UserEventType.CREATE.编辑,复制和其他人不按照规范捕获销售订单操作.任何人都可以验证这一点.我附加了一个非常简单的UserEvent脚本,该脚本应抛出上下文类型,但它不起作用.
此UserEvent脚本用于销售订单记录:
/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*/
define(["N/record", "N/search"],
function (record, search) {
function beforeSubmit(context) {
throw "beforeSubmit:" + context.type;
}
function afterSubmit(context) {
throw "afterSubmit:" + context.type;
}
function beforeLoad(context) {
throw "beforeLoad:" + context.type;
}
return {
beforeLoad: beforeLoad,
beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};
});
Run Code Online (Sandbox Code Playgroud) 我想重新安排计划脚本,当计划脚本使用到达州长限制之前.Netsuite中的计划脚本有10,000个单位.在SuiteScript 1.0版本中,重新安排是通过"nlapiScheduleScript()api"实现的,但在SuiteScript 2.0版本中,如何重新安排脚本.
帮助我实现这一目标,提前谢谢.
当我尝试在 NetSuite 中创建新的脚本记录时,它不允许我选择 API 版本 2.0。它只是说“选择 1.0 脚本类型”。
我是否只需要在 1.0 脚本的顶部添加 SuiteScript 2.0 注释,或者是否必须启用 NetSuite 中的设置才能创建新的 SuiteScript 2.0?
我真的很讨厌 netsuite suite script 2.0 处理日期格式的方式。因此,我想使用 Moment.js 来解析从 Web 服务调用返回的日期。我如何让它在套件脚本 2.0 中工作?
正如erictgrubaugh所说,我需要将 moment.js 库添加到 NetSuite 文件柜,然后在调试器中使用该库。另请注意,我的脚本位于文件柜 -> SuiteScripts -> 库中
但即便如此,我还是遇到了语法问题。因为当我使用调试器时,它现在不会抛出任何错误,但我无法单步执行任何代码,并且日志语句不会打印任何内容。
/** * @NApiVersion 2.x
* @NScriptType ScheduledScript
*/
define ([
'N/log',
'../Libraries/moment',
],
function(log, moment) {
var a = moment('2016-01-01');
var b = a.clone().add(1, 'week');
log.debug(b);
});
Run Code Online (Sandbox Code Playgroud) 我正在编写一个套件脚本来将订单详细信息发送到客户的电子邮件地址。
是否可以通过 scriptContext 或类似方法获取销售订单 ID?
我的功能在提交后在销售订单上运行。
function afterSubmit(scriptContext){
soid = scriptContext.soid; //<--trying to get the sales order id
}
Run Code Online (Sandbox Code Playgroud) 我正在处理一个 NetSuite 实例,该实例具有多个连接到事务的用户事件脚本。我遇到了问题,它们以错误的顺序运行并导致进程无法完成。我认为发生这种情况是因为 SS2 和 SS1 脚本都是随着时间的推移而创建的,并且没有合并,或者他们没有重写的预算。有什么方法可以订购脚本或使用工作流来触发脚本吗?
在此先感谢您的帮助。
我对这方面还很陌生NetSuite,SuiteScript 2.0尤其是。我已经开发了几个应用程序,但我发现在互联网上几乎找不到任何关于SuiteScript. 我的意思是,如果您使用React或Vue或其他流行的框架,您可以轻松地搜索您遇到的问题,并且很可能您会找到几个答案,这绝对很酷。
有NetSuite Help Center一些API我一直使用的文档。有一个套件答案,您可以在其中找到NetSuite支持人员的帮助。但这些只是内部资源,有其优点和缺点。正如我之前提到的,我确实尝试在网络上寻找其他资源,人们可以在其中分享他们的经验(最佳实践等),但不幸的是没有找到任何东西。即使在这里stackoverflow,也没有那么多人喜欢SuiteScript。
那些曾经合作过NetSuite一段时间的人,请分享一些信息,在哪里可以找到按需帮助。
我需要获取当前用户\xe2\x80\x99s 凭据(用户 ID 和密码)并将其与套件中的自定义用户 ID 字段和密码字段进行比较。有没有办法做到这一点?
\n\n感谢您的所有帮助!
\n