Question

Is there an api call that will retrieve all possible values for a field via a RESTlet script for Netsuite?

For example, I want to return all of the possible class field values (Class 1, Class 2, ...) for an inventory item.

I have already tried nlapiGetFieldValues('class') but without success. I'm guessing that is a client side only call?

Was it helpful?

Solution

Similar to what Suite Resources said, but use some pre-existing records for the classes you want to evaluate:

switch(true){
    case req.type == 'customer':
        var x = nlapiLoadRecord('class',1000);

        and either

        return x; OR return x.getAllFields() OR return JSON.stringify(x);
    case req.type == 'salesorder':
...... etc.

}

I'd personally just return the whole record to get subfields and prototype functions.

OTHER TIPS

RESTLets are written in SuiteScript, so look at the supported records.

Class (classification).

You can write up a saved search within the UI, then use nlapiSearchRecord in your RESTLet. Loop through the results of the search and append to an array of objects representing the record. Then use JSON.stringify and return results. Pretty easy.

Try coding it up and post the code if you have issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top