3

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
C.Neal
  • 319
  • 3
  • 12

2 Answers2

4

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", ...

Shea Brennan
  • 1,132
  • 7
  • 16
  • 2
    This would be my guess as well. The enumerations provided by NetSuite are only for native records. They would not be able to enumerate your custom record types unless they are dynamically generating the enumeration every time the `N/record` module is loaded, which I would highly doubt they'll ever do. Putting the raw string ID for the `type` parameter should work. – erictgrubaugh Aug 16 '16 at 20:16
  • This is correct. I've used this a few times, in our scripts. – w3bguy Aug 17 '16 at 12:14
1

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
prasun
  • 7,073
  • 9
  • 41
  • 59