RE: Populating custom field through Restlet

I have the following issue with restlets in Netsuite. I can not update any value on custom fields on any record. The record.setValue, record.setCurrentSublistValue, record.setText, record.setCurrentSublistText functions all seem to be ignoring my input when I set options.fieldId to a custom field, defined by another bundle/SuiteApp. For example, I have been trying to populate the field custcol_nl_wkr_category on a VendorBill’s expense sublist, or the custpage_eft_custrecord_2663_entity_acct_no/custpage_2663_entity_file_format fields on a customrecord_2663_entity_bank_details custom record.

I know that the function calls are actually executed, because I added logs just before and after, but they just seem to be ignored, there are no errors. Also when I wrap the call in a try/catch clause, nothing happens (no error is logged). Any other standard NetSuite field will work as expected.

A sample script of what I am trying:

rec = record.create({
    type: 'vendorbill',
    isDynamic: true,
});

// ... set some other fields

rec.selectNewLine({
    sublistId: 'expense',
});

// ... set some other line fields

rec.setCurrentSublistValue({
    sublistId: 'expense',
    fieldId: 'custcol_nl_wkr_category',
    value: line.wkrCategory // this comes from the payload of the restlet, is of type string
});

rec.commitLine({
    sublistId: 'expense',
});

rec.save();

What else I have tried:
– Use record.setCurrentSublistText
– Make sure that the SuiteApp this restlet is deployed in, has the correct dependency on the SuiteApp the custom field is deployed in.
– Make sure that the user that executes the script has the permissions to set the field and read the items the field can have.
– Wrap the function call in a try/catch clause, and log the catched error, nothing was logged.
– Instead of populating the value from the payload, populate a hardcoded value which I know is a valid value for the field (so value: '2')

As I said above, I have a similar issue with creating a custom record of type customrecord_2663_entity_bank_details, with setting the custom fields on that type. So I think the problem lies with setting custom fields that belong to other SuiteApps/bundles.

wim Rookie Asked on June 25, 2025 in SuiteScript.
Add Comment
5 Answers

To populate a custom field via a RESTlet, ensure your script handles record.load, setValue for that field, and record.save. The RESTlet’s role must have write permissions on both the script and the target record type.

Rookie Answered on July 22, 2025.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.