如何使用RESTlet获取Netsuite中特定记录类型的所有自定义字段? [英] How to get all custom fields of a particular record type in Netsuite using RESTlet?

查看:225
本文介绍了如何使用RESTlet获取Netsuite中特定记录类型的所有自定义字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用RESTlet创建客户,潜在客户,联系人.但是我的代码被创建带有必需选项的自定义字段的人使用.当我尝试创建客户时,通过自定义必填字段出现错误.

I can create a customer, lead, contact using RESTlet. But my code is used by someone who created custom fields with required option. When I try to create a customer, I am getting error by custom required fields.

我也想传递自定义必填字段的数据.如何知道使用RESTlet按必填和非必填分类的所有自定义字段?

I want to pass the data for custom required fields too. How to know the all custom fields categorized by required and none required using RESTlet?

推荐答案

您可以使用

var record = nlapiCreateRecord(RECORD_TYPE);
var fields = record.getAllFields();
var requiredFields = [];
fields.forEach(function(fieldName){
 var field = record.getField(fieldName);
 //I am not very sure, its true or T but, below code will work
 if(field.mandatory === true || field.mandatory === 'T'){
   requiredFields.push(field.getName()) //getLabel() for UI label, as getName returns id;
 }
});

//requiredFields数组是您的需要.

//requiredFields array is your need.

这篇关于如何使用RESTlet获取Netsuite中特定记录类型的所有自定义字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆