How to get all custom fields of a particular record type in NetSuite?

To know the mandatory fields and non-mandatory fields in a particular record type by using the following code:

var record = nlapiCreateRecord(RECORD_TYPE);
var fields = record.getAllFields();
var requiredFields = [];
fields.forEach(function(fieldName){
var field = record.getField(fieldName);
if(field.mandatory === true || field.mandatory ==='T'){
requiredFields.push(field.getName())
}
});

The required custom fields will be fetched. So, that it will be easier to pass the values to custom fields and get the values from custom fields.

Leave a comment

Your email address will not be published. Required fields are marked *