html - 尝试在 NetSuite 中创建两个自定义按钮,一个有效,另一个无效
问题描述
我正在尝试在 NetSuite 中添加第二个自定义按钮来打印项目标签。如果单击第一个按钮,将打开 pdf 模板以打印一张标签。第二个按钮是打开一个模板,为斑马打印机每张打印一个标签。如果我粘贴链接到按钮的地址并手动输入recordId,我可以弹出模板,而不是通过按钮。
用户事件:
function UserEventAddPrintBtn() {
try {
var internalId = nlapiGetRecordId();
var button1 = form.addButton('custpage_button1', 'Print Item Labels (Sheet)',"irlabelBtn()");
//set the internal id of the created Client script.
var button2 = form.addButton('custpage_button2', 'Print Item Labels (Zebra)',"irlabelBtn2()");
//set the internal id of the created Client script.
form.setScript('customscript_atn_client_rec_label');
}
catch (exception) {
nlapiLogExecution('DEBUG', 'Error in AddButton()', exception);
}
}
客户端脚本
function irlabelBtn() {
var recordId = nlapiGetRecordId();
var baseUrl = '/app/common/custom/advancedprint/printsearchresults.nl?printType=SEARCH&l=T&e=T&id=1150&style=NORMAL&sortcol=Transction_ORDTYPE9_raw&sortdir=ASC&searchid=1150&csv=Export&printtemplate=146&Transaction_INTERNALID=';
var windowUrl = baseUrl + recordId;
//alert (recordId);
window.open(windowUrl);
}
function irlabelBtn2() {
var recordId2 = nlapiGetRecordId();
var baseUrl2 = '/app/common/custom/advancedprint/printsearchresults.nl?printType=SEARCH&l=T&e=T&id=1150&style=NORMAL&sortcol=Transction_ORDTYPE9_raw&sortdir=ASC&searchid=1150&csv=Export&printtemplate=147&Transaction_INTERNALID=';
var windowUrl2 = baseUrl2 + recordId2;
//alert (recordId2);
window.open(windowUrl);
}
解决方案
我想通了,检查了我的客户端脚本并且它有效。
function irlabelBtn() {
var recordId = nlapiGetRecordId();
var baseUrl = '/app/common/custom/advancedprint/printsearchresults.nl?printType=SEARCH&l=T&e=T&id=1150&style=NORMAL&sortcol=Transction_ORDTYPE9_raw&sortdir=ASC&searchid=1150&csv=Export&printtemplate=146&Transaction_INTERNALID=';
var windowUrl = baseUrl + recordId;
//alert (recordId);
window.open(windowUrl);
}
function irlabelBtn2() {
var recordId = nlapiGetRecordId();
var baseUrl = '/app/common/custom/advancedprint/printsearchresults.nl?printType=SEARCH&l=T&e=T&id=1150&style=NORMAL&sortcol=Transction_ORDTYPE9_raw&sortdir=ASC&searchid=1150&csv=Export&printtemplate=147&Transaction_INTERNALID=';
var windowUrl = baseUrl + recordId;
//alert (recordId2);
window.open(windowUrl);
}
推荐阅读
- python - 如何检查集合中的每个字符串是否包含列表中的每个字符串?
- microsoft-graph-api - /teams/allMessages 创建订阅 API 的问题
- mongodb - mongo shell 查询不适用于嵌套文档
- stripe-payments - 如何检索已连接帐户的 Stripe 会话 ID?
- flutter - 编写此飞镖迭代并返回列表的更好方法是什么
- c++ - 为什么字符数组不给出无符号结果
- c++ - 如何将 dll 库链接到我的应用程序?
- javascript - git 中的路径错误,无法在...处创建目录 无效的参数
- python - 如何将表格值从 Web 表单获取到 post 方法 python 烧瓶中?
- c# - 我在 C# 中的表中插入数据时遇到问题