Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 390
FreeMarker12 Avatar asked Nov 27 '16 01:11

FreeMarker12


2 Answers

Like this:

var mergeRecord = record.load({
type: 'custrecord_merge_vendor', 
id: '12',
isDynamic: true
});
like image 74
Adolfo Garza Avatar answered Oct 04 '22 16:10

Adolfo Garza


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

like image 37
erictgrubaugh Avatar answered Oct 04 '22 16:10

erictgrubaugh