netsuite自动填充字段

netsuite自动填充字段,netsuite,suitescript,Netsuite,Suitescript,下面是一段代码,用于使用自定义实体字段自动填充销售订单中的字段 function exampleFieldChangedFunction(type, name, linenum){ if(name == 'entity'){ //this line will make sure that the field being changed is the 'customer' field var customerValue = nlapiGetFieldValue('entity');

下面是一段代码,用于使用自定义实体字段自动填充销售订单中的字段

function exampleFieldChangedFunction(type, name, linenum){
  if(name == 'entity'){ //this line will make sure that the field being changed is the 'customer' field
    var customerValue = nlapiGetFieldValue('entity');   //the value of the customer field

    var customerclassValue = nlapiLookupField('entity', customerValue, 'custentitykn_division_regions');    //Class value on the customer record

    var customerClass = nlapiLookupField('custentitykn_division_regions', customerclassValue, 'class');

    nlapiSetFieldValue('class', customerClass); //auto-populate Division/Region with the new customer's class value
  }
}

您遇到了什么问题?代码运行不正确,无法填充。是否收到任何错误消息?是在警报中还是在控制台中?您提供的详细信息越多,我们能提供的帮助就越大。您能解释一下您试图用这行代码做什么吗:
nlapiLookupField('cusentitykn\u division\u regions',customerclassValue,'class')
?要执行查找,第一个参数必须是记录类型而不是字段值。字段列出的记录类型是细分/区域的类记录。是,每个人都有权查看所有客户部门/地区记录。