FreeMarker12
FreeMarker12

Reputation: 115

Loading custom record in SuiteScript 2.0

I'm trying to load a custom record like below:

var mergeRecord = record.load({
    type: record.Type.'custrecord_merge_vendor', 
    id: '12',
    isDynamic: true
});

This seems wrong.. but the equivalent for standard records is like below:

var objRecord = record.load({
    type: record.Type.SALES_ORDER, 
    id: 157,
    isDynamic: true,
});

How to do this ?

Upvotes: 7

Views: 9907

Answers (2)

Adolfo Garza
Adolfo Garza

Reputation: 3029

Like this:

var mergeRecord = record.load({
type: 'custrecord_merge_vendor', 
id: '12',
isDynamic: true
});

Upvotes: 11

erictgrubaugh
erictgrubaugh

Reputation: 8847

You have the right idea, except that you are not passing the correct record type for your Custom Record into the type property. The correct value will just be the string that is your Custom Record's internal ID; it will start with customrecord_. You will not use the record.Type enumeration as that is only for native record types.

Because something like record.Type.'custrecord_merge_vendor' is not even valid syntax, I highly suggest you familiarize yourself with the fundamentals of the JavaScript language. You can find tons of introductory information and examples over at MDN

Upvotes: 5

Related Questions