0

Evening All,

I'm working with my first search script with a join, and I can't for the life of me get the parent information to show anything (showing as null) in the console. I know I'm missing something very basic.

Search code as below:

        var parent = 'customrecordvendorpricereview';   // custom parent record
        var child  = 'customrecordvpri_reviewitems';    // custom child record
        var join   = 'custrecordvpri_header';           // field on the child record which points to the parent record

        var filters = new Array();
            filters[0] = new nlobjSearchFilter('custrecordvpr_processed',join,'is','T' );                 log(filters[0]);// check if the review is ready to process
            filters[1] = new nlobjSearchFilter('custrecordvpr_completed',join,'is','F' );                 log(filters[1]);// check if the review has not already been processed
            filters[2] = new nlobjSearchFilter('custrecordvpr_cancelreview',join,'is','F' );              log(filters[2]);// check if the review has been cancelled.
            filters[3] = new nlobjSearchFilter('custrecordvpr_effectivedate',join,'within','thisWeek' );  log(filters[3]);// check if the review is effective within the last week.
        var columns = new Array();
            columns[0]  = new nlobjSearchColumn('internalid',join);                                       log(columns[0]);// VPR Review Header Record ID
            columns[1]  = new nlobjSearchColumn('custrecordvpr_supplier',join );                          log(columns[1]);// VPR Review Supplier
            columns[2]  = new nlobjSearchColumn('custrecordvpr_effectivedate',join );                     log(columns[2]);// VPR Effective Date
            columns[3]  = new nlobjSearchColumn('custrecordvpr_thisrate',join );                          log(columns[3]);// VPR Exchange rate for this review
            columns[4]  = new nlobjSearchColumn('custrecordvpri_header' );                                log(columns[4]);// VPRI Field ID >> links to parent
            columns[5]  = new nlobjSearchColumn('custrecordvpri_item' );                                  log(columns[5]);// VPRI Item ID 
            columns[6]  = new nlobjSearchColumn('custrecordvpri_vendorcode' );                            log(columns[6]);// VPRI Vendor Code
            columns[7]  = new nlobjSearchColumn('custrecordvpri_prefsupplier' );                          log(columns[7]);// VPRI Preferred Supplier
            columns[8]  = new nlobjSearchColumn('custrecordvpri_newprice' );                              log(columns[8]);// VPRI New Vendor Price
            columns[9]  = new nlobjSearchColumn('custrecordvpri_prefer' );                                log(columns[9]);// VPRI Review vendor is preferred
            columns[10] = new nlobjSearchColumn('custrecordvpri_newstdcost' );                            log(columns[10]);// VPRI New Standard Cost 
            columns[11] = new nlobjSearchColumn('custrecordvpri_stdcostchange' );                         log(columns[11]);// VPRI New Standard Cost Change
            columns[12] = new nlobjSearchColumn('custrecordvpri_salepricechange' );                       log(columns[12]);// VPRI New Sales Price Change
            var res = nlapiSearchRecord( child, null, filters, columns);
            return res;

I would greatly appreciate some clarification on this area, as the documentation can be a little ambiguous.

Also, when I remove the filters, I get all the child record data, but the parent fields show as null.

Steve Reeder
  • 980
  • 16
  • 42

1 Answers1

0

OK, I found the mistake, I needed to add the 'join' to the getValue. The filters were right, just all the data was excluded by one of the T/F fields.

Steve Reeder
  • 980
  • 16
  • 42