Netsuite – REST API – How to create new Entry record with Token Based Authentication (TBA) – (in Python)

This is a follow up to the successful call using Netsuite Token Based Authentication (TBA) REST webservice,

I would like to get some guidance on how to create a NEW ENTRY RECORD.

Here is my custom type record entry list (please see screenshot)

enter image description here <– here is the python code for the TBA that has worked successful. I would like to know how to construct the next step on how to create a new entry.

This is a custom record with an ID like this customrecord1589

FYI – here is my other question on query Netsuite – REST API – Making query with Token Based Authentication (TBA) – (in Python) But this question would be creating a new entry record


Within your restlet you need to use the N/record module to create a new custom record, here is what is should look similar to:

 * @NApiVersion 2.1
 * @NScriptType Restlet
define(["N/log", "N/record"], function (log, record) {
    function post(context) {
        return JSON.stringify(createCustomRecord(context));

    function createCustomRecord(context) {
        let success = true;
        try {
            let custRec = record.create({
                type: "customrecord1589",
                isDynamic: true,
            //Set one or more fields here
                fieldId: "custrec123",
                value: context.custrec123,
        } catch (e) {
            log.error("Error creating record", e);
            success = false;
        return { success: success };

    return {
        post: post,