C.Neal
C.Neal

Reputation: 329

How to perform SubmitFields onto a custom record in SuiteScript 2.0?

To perform SubmitFields onto standard Netsuite Records (i.e. Purchase Orders) it is something like this:

    var poId = context.key; 

    var id = record.submitFields({
        type: record.Type.PURCHASE_ORDER,
        id: poId,
        values: {
            custbody_someField: someValue
        },
        options: {
            enableSourcing: false,
            ignoreMandatoryFields : true
        }
    });

What is the type field for Custom Records? I tried the ID of the Custom Record, but it doesn't work: e.g.

type: record.Type.customrecord_my_record_id

Upvotes: 3

Views: 4987

Answers (2)

prasun
prasun

Reputation: 7343

That is true that the references are only for standard record types. You can alternatively get all enums into a variable and log it using

var recordTypesEnums = Object.keys(record.Type);
//you may log recordTypesEnums array

Upvotes: 1

Shea Brennan
Shea Brennan

Reputation: 1132

I don't know what the 'official' answer is. The fake enum types don't have any custom record references that I was able to find. Setting the type to the string that is the id of the custom record works for me. (No record.Type. prefix though)

... type: "customrecord_my_record_id", ...

Upvotes: 4

Related Questions