简体   繁体   English

在采购订单输入中使用SuiteScript修改Netsuite UI

[英]Netsuite UI Modification with SuiteScript in Purchase Order Entry

NetSuite currently has the ability to "COPY PREVIOUS" during the line item entry on a Purchase Order, but upon change of the item number, the system will overwrite the description and unit price with the defaults from the Item Master table. NetSuite当前可以在采购订单的行项目输入期间“复制”,但是在更改项目编号时,系统将使用“项目主数据”表中的默认值覆盖描述和单价。 Can somebody assist me with a challenge in SuiteScript in which I need to address the previous record in a scrollable table ? 有人可以协助我应对SuiteScript中的挑战,因为我需要解决可滚动表中的上一条记录吗? ie Line 2 on a Purchase Order during Data Entry. 即在数据输入期间采购订单上的第2行。 How do I refer to the previous line in SuiteScript? 如何在SuiteScript中引用上一行? I would need to execute this code after the user selected a different Item Number. 用户选择其他项目编号后,需要执行此代码。

Thanks for your help... 谢谢你的帮助...

You can use a client-side script, particularly in the Field Change function. 您可以使用客户端脚本,尤其是在“字段更改”功能中。

This code ain't perfect but should help you get started, make sure that you deployed this in the Purchase Order transactions: 这段代码并不完美,但是应该可以帮助您入门,请确保已将其部署在“采购订单”事务中:

function fieldChanged(type, name, linenum){
    if(type == 'item' && name == 'item')
    {
        {
            var currIndex = nlapiGetCurrentLineItemIndex('item');  //Get the current index, this is the total count of line items in the transaction
            if(currIndex > 1) //You have to have at least two line items to be able to refer to the previous line item
            {
                var prev = currIndex - 1;
                var itemNo  = nlapiGetLineItemValue('item', 'item', prev); //This it the item number from the previous line item..Do whatever you want from here....
            }
        }
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM