How to get all custom fields of a particular record type in Netsuite using 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.

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?


You can use

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 array is your need.


Actually in this situation I take one of two approaches (or combine them):

The first is to just ignore mandatory fields. You view your code's job is to get information into Netsuite and users will have to be responsible for future updates. You do this by telling Netsuite to ignore mandatory fields when your code saves them:

nlapiSubmitRecord(nlobjRecord, doSourcing, ignoreMandatoryFields); //doSourcing and ignoreMandatoryFields are booleans

or I add a text area parameter to the restlet where the person configuring the restlet has to enter a list of extra fields you want to do something with (e.g. display in a dialog and make required)


  • How to get customer aging fields from a Netsuite restlet
  • Silverstripe returning a populated form via controller
  • How to throw an exception, if an object structure is not matching/fitting another one
  • Describe relationship in maximo 7.5
  • How to create a TFS alert for changes to the items' Stack Rank field
  • Get column names and values in for loop PHP
  • Cannot access sitecore item field via API
  • Efficient algorithm to find additions and removals from 2 collections
  • Enumerating Controls on a Form
  • Extract All Possible Paths from Expression-Tree and evaluate them to hold TRUE
  • XSLT foreach repeating nodes to flat
  • List images(01.png) and descriptions(01.txt) from directory
  • d3 v4 drag and drop with TypeScript
  • How to render a blob on a canvas element?
  • How to use RequestBodyAdvice
  • debug library loaded with ctypes using gdb
  • JQuery Internet Explorer and ajaxstop
  • Very simple C++ DLL that can be called from .net
  • D3 nodes and links from JSON with nested arrays of children
  • Why does access(2) check for real and not effective UID?
  • Is there a javascript serializer for JSON.Net?
  • Array.prototype.includes - not transformed with babel
  • Fill an image in a square container while keeping aspect ratio
  • Where to put my custom functions in Wordpress?
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • How to limit post in wp_query
  • Websockets service method fails during R startup
  • bootstrap to use multiple ng-app
  • Comma separated Values
  • How to delete a row from a dynamic generate table using jquery?
  • How to set the response of a form post action to a iframe source?
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?