user125264
user125264

Reputation: 1827

Suitescript nlapiSearchRecord cant load custom record

I've got what is probably a simple issue, but cant seem to find an answer to it.

I have a custom record, with an list field containing the item records in the account.

Whenever I run the script it returns the 2 rows in the custom record, rather than the specific record im trying to source.

I know its list is just the items list, but when i try '10' as the internal id of the specific item record it throws an error.

nlobjSearchFilter('custrecord_pm_int_inventory_item',null,'is','10');

it throws an error, i have seen similar posts on stackoverflow for this, but not exactly trying to load a custom record that has a list field of item

// if inventory item has been found, check to see if it exists in the item tracking record
                var filt    = [];
                    filt[0] = new nlobjSearchFilter('custrecord_tc_int_inventory_item',null,'is','88999 shipping');
                var cols    = [];
                    cols[0] = new nlobjSearchColumn('internalid');
                    cols[1] = new nlobjSearchColumn('custrecord_tc_int_inventory_item');
                var search  = nlapiSearchRecord('customrecord_tc_int_item_tracking',null,filt,cols);

Hopefully im just missing something simple, but i cant seem to load the record, any ideas greatly appreciated

Upvotes: 0

Views: 981

Answers (1)

Adolfo Garza
Adolfo Garza

Reputation: 3029

You gotta use anyof operator and pass an array, here's how it should look:

// if inventory item has been found, check to see if it exists in the item tracking record
var filt    = [];
    filt[0] = new nlobjSearchFilter('custrecord_tc_int_inventory_item',null,'anyof',['10']);
var cols    = [];
    cols[0] = new nlobjSearchColumn('internalid');
    cols[1] = new nlobjSearchColumn('custrecord_tc_int_inventory_item');
var search  = nlapiSearchRecord('customrecord_tc_int_item_tracking',null,filt,cols);

Upvotes: 1

Related Questions