【问题标题】:Netsuite: Check Payee field in Check form is Vendor or notNetsuite:检查表单中的收款人字段是否为供应商
【发布时间】:2018-07-26 07:58:53
【问题描述】:

我正在使用“交易”>“银行”>“写支票”中的支票表格。 我必须检查收款人类型是否是供应商。 Payee 字段中的数据是一个记录。它链接到谁订购并付款的形式。但我不知道如何检查这样的字段中的数据类型。那么我该如何检查呢?

This is the Check screen and the Payee field in it

function beforeLoad(scriptContext) {
    var contextRecord = scriptContext.newRecord;
    var payeeType = contextRecord.getField("entity");
    if(contextRecord.type === context.UserEventType.EDIT || contextRecord.type === context.UserEventType.CREATE){
        if('what can I do to check payee type')
        //Do something if Payee Type is Vendor
    }
}

【问题讨论】:

    标签: netsuite suitescript2.0


    【解决方案1】:

    不幸的是,您无法从“实体”字段中获取类型,它只会返回实体的内部 id。我最好的建议是进行一种猜测和检查策略,您可以查看该实体是供应商还是员工。这是使用您的脚本的示例。

    function beforeLoad(scriptContext) {
        var contextRecord = scriptContext.newRecord;
        var payeeId = contextRecord.getValue({ fieldId: 'entity' });
        if(contextRecord.type === context.UserEventType.EDIT || contextRecord.type === context.UserEventType.CREATE){
            var internalIdObj = search.lookupFields({ type: search.Type.VENDOR, id: payeeId, columns: ['internalid'] });
            if (Object.keys(internalIdObj).length > 0) {
                // Must be a vendor so do logic here
            }
        }
    }
    

    您可以将我们的search.Type.VENDOR 切换为search.Type.EMPLOYEE 或任何其他记录类型来检查这些。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-01
      • 2012-06-21
      • 1970-01-01
      • 1970-01-01
      • 2015-06-27
      • 2020-02-27
      • 1970-01-01
      相关资源
      最近更新 更多