Does any one know of a single API call to get all ...
# suitescript
n
Does any one know of a single API call to get all fields of a netsuite record in SS2.0? For example if i want all the fields on the department record, i would like to run just one api call and get all the fields and its values.
c
record.load will bring most of them
n
well im looking to get all the fields. So after i do record.load, is there something like a record.getAllFields where i get a JSON with all the field values of the loaded record?
Right now after you load the record you have to do something like this to get each field: var value = objRecord.getValue({ fieldId: 'item' }); What i would like to do if possible is to get all fields without explicitly asking for each field Id
j
There's method to get all the field ids of the record or sublist but it sounds like you want the values together
You could see what happens when you JSON.stringify the record object and parse it back maybe that will give you what you want.
c
You can iterate though getFields() and do getValue for each
n
@JohnnyC Good idea, ill try your suggestions, it may just work.
@CreationByte I will try this as well
c
You also have getSublists() for the lists
hope that helps
j
I suspect the complete record sent to JSON and then parsed back will be more info then you might want and would be rather large, not recommending using that for anything API related in NetSuite stick to the getFields, getSublists and getSublistFields, and just iterate over the results of those calls to get or set values.
💯 1