我想禁用(或)隐藏自定义记录类型的查看模式上的标准“编辑”按钮。我没有使用标准按钮,而是使用自定义按钮来访问特定用户的记录编辑页面。所以我想禁用标准编辑按钮。
我的代码:
脚本版本:套件脚本 2.0
客户端脚本
function pageInit(scriptContext) {
var approved = 3;
var currentRecord = scriptContext.currentRecord;
var status = currentRecord.getValue("custrecord_lst_ch_status");
//Hiding The Standard Edit Button When the Status Field is in Approved State
if (status == approved) {
document.getElementById("edit").disabled = true;
document.getElementsByName("edit")[0].disabled = true;
}
}
Run Code Online (Sandbox Code Playgroud)
错误: 我无法获得“编辑”按钮的 ID。它正在获取 NULL 值。
可以使用客户端脚本(或)用户事件脚本禁用(或)隐藏记录的查看模式。
提前致谢。
我尝试根据记录类型和索引获取记录。
请求: {"recordtype":"customer","gu_action":"get_all","size":1000,"index":0}
它的工作正常。但是 Api 需要 4-5 分钟来响应每个 api 调用。知道如何减少这个时间吗?
我的 Restlet 代码:
get_all 动作将调用 get_Allrecords 函数:
/********************** Get All records of Record type *******************************/
function get_Allrecords(datain) {
var all_IDs = getAllIDs(datain);
var len = all_IDs.length;
var result = new Array();
var results = new Array();
var fields = datain.fields;
for (var i = 0; i < len; i++) {
var required_result = {};
try {
result[i] = **nlapiLoadRecord(all_IDs[i].getRecordType(), all_IDs[i].id);**
if(fields != undefined && fields.length > 0) {
for( var …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取与采购订单相关的所有项目。我已经在 UI 中创建了保存的搜索,但是我需要传递 PO 的内部 ID 才能获得正确的项目列表。我尝试在suitescript 中执行此操作,但找不到Item 的正确连接表?查看记录浏览器,我找不到项目。这不可能吗?
var poItemSearch = search.create({
type: 'transaction',
filters : [
search.createFilter({
name : 'type',
operator : search.Operator.IS,
values : 'Purchase Order'
}),
search.createFilter({
name : 'internalid',
operator : search.Operator.ANYOF,
values : poID
}),
search.createFilter({
name : 'item',
join : 'item',
operator : search.Operator.IS,
values : 'Inventory Item'
})
],
columns: [
search.createColumn({name : 'item'})
//search.createColumn({name : 'email', join : 'custrecord_sdr_prod_pref_customer'}),
//search.createColumn({name : 'subsidiary', join: 'custrecord_sdr_prod_pref_customer'}),
//search.createColumn({name : 'custrecord_sdr_prod_pref_item'}),
//search.createColumn({name : 'custrecord_sdr_prod_pref_qty'}),
//search.createColumn({name …Run Code Online (Sandbox Code Playgroud) 我很难在 SS2 中获得要呈现的语句,我发现答案是 SS1 并且有一段时间没有使用过它,但它似乎在 ss2 中不起作用。我正在使用 SS2 render.statement 方法,但我收到了一个 "error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":null,"stack":["renderStatement(N/render.js)" 我我不清楚一些论点实际上是什么。我认为 entityid 是客户 ID,printMode 是 pdf 枚举,formId 我不知道,它说它需要一个数字,但我没有像 NetSuite 中的其他对象一样在列表中的表单旁边看到内部 ID,我打开了 InternalIds。StartDate 是您要开始提取交易之前的日期?声明日期?今天的日期?OpentransactionOnly 为真。
谢谢
NetSuite 中是否有任何日志提供有关 SuiteScript 性能的信息?例如,当我保存采购订单时,我希望能够看到所有执行的 SuiteScripts(包括来自 3rd 方包的 SuiteScripts)及其运行时。这可能吗?
我收到来自 Netsuite 的自动电子邮件错误。
Account: 45447
Environment: SandBox
Date & Time: 7/20/2017 3:55 pm
Record Type: Invoice
Internal ID: 6974547
Execution Time: 0.00s
Script Usage: 0
Script: Invoice Pingback
Type: User Event
Function: afterSubmitInvoice
Error: UNEXPECTED_ERROR
Ticket: j5bwm0cu2oj2ilksh
Stack Trace: nlapiRequestURL(invoice_pingback2.js$25817:1129)
afterSubmitInvoice(invoice_pingback2.js$25817:13)
<anonymous>(invoice_pingback2.js$25817:18)
Run Code Online (Sandbox Code Playgroud)
我的问题是,我可以访问并查看有关此错误的更多信息的 Netsuite 日志中的任何详细信息。这是一个 UNEXPECTED_ERROR,但我需要了解有关它的更多详细信息。
我实际上正在开发一个基于 netsuite 产品的新项目。我正在尝试使用 hmac sha256 加密消息。
考虑到我有 stringToEncrypt 和密钥,最简单的方法是什么。
我已经阅读了 Netsuite 中的文档,但我仍然陷入困境......
有我的功能
function toHmacSHA256Base64(toCrypt, key) {
var inputString = toCrypt;
var myGuid = key;
var sKey = crypto.createSecretKey({
guid: myGuid,
encoding: encode.Encoding.UTF_8
});
var hmacSHA256 = crypto.createHmac({
algorithm: 'SHA256',
key: sKey
});
hmacSHA256.update({
input: inputString,
inputEncoding: encode.Encoding.BASE_64
});
var digestSHA256 = hmacSHA256.digest({
outputEncoding: encode.Encoding.HEX
});
return digestSHA256;
};
Run Code Online (Sandbox Code Playgroud)
当然,在这个词后面crypto我使用了模块'N/crypto'and encode 'N/encode'。多谢。
我们正在NetSuite上编写脚本,以与第三方应用程序集成。
当您访问记录时(无论是查看还是编辑),我们需要确定NetSuite用户对该记录具有哪种权限。
通过文档,我知道这些是可能的权限值:
我也知道我可以通过以下方式获得用户权限:
var userObj = runtime.getCurrentUser();
var permission = userObj.getPermission('ADMI_ACCOUNTING')`
Run Code Online (Sandbox Code Playgroud)
问题是我需要根据我当前所在的记录知道要具体要求的权限。我无法在currentRecord中找到一个值,该值可以让我请求对用户对象的权限以使其能够确定用户对记录的权限级别。
任何对如何实现这一目标有想法的人,我将非常感谢!
Netsuite 说在创建自定义模块时包含模块 ID,如下所示:
define(module_id, [dependencies], function)
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做时,找不到模块:
TypeError: Cannot read property "XPELPCenterModule" from undefined (/path/to/mysuitelet.js#35)
Run Code Online (Sandbox Code Playgroud)
当我删除ID时,它起作用了???
Hello Human Coder
Run Code Online (Sandbox Code Playgroud)
我错过了什么。我用同样的方式称呼他们两个
function (ui, email, runtime, search, record, log, render, cache, crypto, file, pcenter) {
var p = new pcenter.XPELPCenterModule();
Run Code Online (Sandbox Code Playgroud)
.....
p.helloWorld('Human Coder');
Run Code Online (Sandbox Code Playgroud)
以下是模块代码示例:
define(["require", "exports"],
function (require, exports) {
var XPELPCenterModule = /** @class */ (function () {
function XPELPCenterModule(name) {
this.name = name;
}
XPELPCenterModule.prototype.helloWorld = function (name) {
return 'Hello ' + name;
};
return XPELPCenterModule;
}());
exports.XPELPCenterModule …Run Code Online (Sandbox Code Playgroud) 我试图在用户打开采购订单时修改它。这似乎是一个非常简单的例子,但似乎不起作用。在 GUI 中我没有看到“测试”备忘录。在脚本调试中,备注字段为空。
由于调试,我知道脚本正在运行。
/**
* Update Drop Ship PO with route Information
*
* @author Patrick
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/search', 'N/record'],
function(search, record) {
function beforeLoad(context) {
var newRecord = context.newRecord;
newRecord.setValue({fieldId: 'memo', value: 'this is a test'});
log.debug({title: 'memo', details: newRecord.getValue({fieldId: 'memo'})});
return true;
}
return {
beforeLoad: beforeLoad
};
});
Run Code Online (Sandbox Code Playgroud)
我假设它与我可以修改的记录有关,但我一生都无法在文档中找到有效的示例。任何帮助将不胜感激。