[英]How to pop up a confirmation dialog after user clicks the “Close Order” button of SO in NetSuite?
There is a Close Order button in the Sales Order. 销售订单中有一个关闭订单按钮。
If user clicks the button, the Sales Order will be closed. 如果用户单击按钮,则将关闭销售订单。
We want to pop up a dialog to confirm the click, if user clicks " Yes ", then the Sales Order will close; 我们要弹出一个对话框来确认单击,如果用户单击“ 是 ”,则销售订单将关闭; if user clicks " No ", it will return to the page and nothing happens.
如果用户单击“ 否 ”,它将返回页面,并且什么也没有发生。
I know the button id for the Close Order is " closeremaining ", and we can use the following code to show to confirmation dialog: 我知道平仓单的按钮ID是“ closeremaining ”,我们可以使用以下代码来显示确认对话框:
var options = {
title: "Are you sure you want to close the order?",
message: "Press OK or Cancel"
};
function success(result) {
console.log("Success with value " + result);
}
function failure(reason) {
console.log("Failure: " + reason);
}
dialog.confirm(options).then(success).catch(failure);
But we don't know how to pop the dialog after user clicks the button in VIEW mode. 但是我们不知道用户在“ 查看”模式下单击按钮后如何弹出对话框。 I tried the following but in vain:
我尝试了以下但徒劳的:
var closeOrderBtn = document.getElementById("closeremaining");
closeOrderBtn.addEventListener("click", showConfirmDialog);
Can anyone give me help? 有人可以帮我吗?
Currently, triggering a script from a Standard Button(Close Order) is not yet possible. 当前,尚无法从标准按钮(关闭订单)触发脚本。 What you can do is to hide the standard button and replace it with a custom one so you can have full control of its functionality.
您可以做的是隐藏标准按钮,并用自定义按钮替换它,以便您可以完全控制其功能。
Here is an overview of what you need to do: 以下是您需要做什么的概述:
Also, you can read SuiteAnswers article: SuiteScript > Confirm before Closing a Transaction Record (Id: 65115) since it has a step by step guide on how to implement it. 另外,您可以阅读SuiteAnswers文章:SuiteScript>关闭事务记录之前确认(Id:65115),因为它具有有关如何实现它的逐步指南。 You can use the Id when searching.
您可以在搜索时使用ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.