Netsuite 如何在fieldChanged事件上获取itemtype

Netsuite 如何在fieldChanged事件上获取itemtype,netsuite,Netsuite,我正在从采购订单的子列表item中选择一个项目,我需要进入item register,获取一些信息并将它们放在采购订单的当前行中。我需要在fieldChanged事件(ClientScript)中执行此操作 为此,我需要获取ItemId(用户选择的)和ItemType function fieldChanged(scriptContext) { var currentRec = scriptContext.currentRecord; var currentSublist =

我正在从采购订单的子列表item中选择一个项目,我需要进入item register,获取一些信息并将它们放在采购订单的当前行中。我需要在fieldChanged事件(ClientScript)中执行此操作

为此,我需要获取ItemId(用户选择的)和ItemType

function fieldChanged(scriptContext) {

    var currentRec = scriptContext.currentRecord;
    var currentSublist = scriptContext.sublistId;
    var currentField = scriptContext.fieldId;

    if (currentSublist == 'item'){
        if (currentField == 'item'){
            var itemType = currentRec.getCurrentSublistValue({sublistId: 'item', fieldId: 'itemtype'});
            var itemId = currentRec.getCurrentSublistValue({sublistId: 'item', fieldId: 'item'});
        }
    }
}
itemId设置为用户所选项目的id

itemType为空,我需要获取用户选择的项目的项目类型


是否有人可以帮助我?

在填充相关字段之前,会触发
字段更改事件。您应该将逻辑移动到
postSourcing
事件以实现此目的