I'm trying to get the internal id of a Purchase Or...
# suitescript
b
I'm trying to get the internal id of a Purchase Order in my client script.
Copy code
if ( !isNaN(poNum) ) {
                    //TODO
                    // Get internal ID from PO Transaction id with a search
                    var poSearch = search.create({
                        type: search.Type.TRANSACTION,
                        filters: [
                            ['recordType', <http://search.Operator.IS|search.Operator.IS>, "purchaseorder"], 'and',
                            ['tranid', <http://search.Operator.IS|search.Operator.IS>, poNum], 'and',
                            ['mainline', <http://search.Operator.IS|search.Operator.IS>, 'T']
                        ],
                        columns: [
                            'internalid'
                        ]
                    });

                    var poResult = poSearch.getValue('internalid');
I keep getting error that poSearch.getValue is not a function
b
you want to use a Search method like .run() to get a ResultSet (https://system.na1.netsuite.com/app/help/helpcenter.nl?fid=section_452292724609.html)
and then use a ResultSet method like getRange() to get an array of Results (https://system.na0.netsuite.com/app/help/helpcenter.nl?fid=section_456010986327.html)
b
gotcha, that makes sense, thank you