简体   繁体   English

用户单击NetSuite中SO的“关闭订单”按钮后如何弹出确认对话框?

[英]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: 以下是您需要做什么的概述:

  1. Hide the Close Order button 隐藏关闭订单按钮
  2. Deploy a User Event script and add a button through it 部署用户事件脚本并添加一个按钮
  3. Use a client script to add the functionality that will be performed by the script (Show confirm pop-up) 使用客户端脚本添加将由脚本执行的功能(显示确认弹出窗口)
  4. You can then proceed to close the order by changing the isclosed field to True in the item sublists 然后,您可以通过将项目子列表中的isclosed字段更改为True来继续关闭订单

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.

相关问题 当用户点击该弹出窗口外的页面上的任何位置时,如何关闭动态添加的弹出窗口? - How to close the dynamically added pop-up when user clicks anywhere on the page outside of that pop-up's surface? 用户关闭后如何不让聊天弹出 - How to not let chat pop up appear after user close it 如何关闭模式对话框的弹出窗口? - How to close the pop up window of modal dialog? 当用户单击按钮时弹出一个窗口 - pop-up a window when the user clicks a button 用户单击弹出窗口上的保存按钮刷新主窗口 - user clicks on save button on a pop up window refresh main window JQuery-ui对话框:当用户点击关闭按钮时,如何防止默认操作? - JQuery-ui Dialog: How can I prevent default action when the user clicks on close button? 当用户单击“返回”按钮时,如何关闭SimpleModal对话框? - How can I close a SimpleModal dialog when the user clicks the Back button? 当用户单击菜单按钮时,如何弹出菜单? - How do I make a menu pop up when the user clicks the menu button? 如何防止关闭对话框并刷新时弹出关闭对话框 - how to prevent close dailogbox pop up when close dialog and refresh 单击Salesforce中的自定义按钮后,如何关闭模式弹出对话框 - How to close modal pop up dialog box opened on click of a custom button in salesforce
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM