最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - 'An nlobjSearchColumn contains an invalid column, or is not in proper syntax' in NetSuite - Stack O

programmeradmin0浏览0评论

I'm really new to NetSuite, so I'm sure this is something silly I'm doing wrong, but I'm trying to look up the most recent check number for an Account in a script. So I'm setting up a search on the CustomerPayment table, for the checkNum column. I'm doing that like this:

var acct = nlapiGetFieldValue('account');
var paymentFilters = new Array();
paymentFilters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

var paymentColumns = new Array();
paymentColumns[0] = new nlobjSearchColumn('checknum');

var paymentSearchResults = nlapiSearchRecord('customerpayment', null, paymentFilters, paymentColumns);

But I'm getting a "An nlobjSearchColumn contains an invalid column, or is not in proper syntax: checknum" error. I verified that there is a CustomerPayment table, and there is also a checkNum column within it. At least the Record Browser seems to suggest that. (also the first time I'm using that) I also verified that acct contains the value I'm expecting it to.

I've done a couple other searches, using basically the same code and they seem to work as expected, so I'm not sure what I'm doing wrong. For example, this code seems to work:

    var filters = new Array();
    filters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

    var columns = new Array();
    columns[0] = new nlobjSearchColumn('tranid');

    var searchResults = nlapiSearchRecord('check', null, filters, columns); 

Anyway, any help would be appreciated. Thank you.

I'm really new to NetSuite, so I'm sure this is something silly I'm doing wrong, but I'm trying to look up the most recent check number for an Account in a script. So I'm setting up a search on the CustomerPayment table, for the checkNum column. I'm doing that like this:

var acct = nlapiGetFieldValue('account');
var paymentFilters = new Array();
paymentFilters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

var paymentColumns = new Array();
paymentColumns[0] = new nlobjSearchColumn('checknum');

var paymentSearchResults = nlapiSearchRecord('customerpayment', null, paymentFilters, paymentColumns);

But I'm getting a "An nlobjSearchColumn contains an invalid column, or is not in proper syntax: checknum" error. I verified that there is a CustomerPayment table, and there is also a checkNum column within it. At least the Record Browser seems to suggest that. (also the first time I'm using that) I also verified that acct contains the value I'm expecting it to.

I've done a couple other searches, using basically the same code and they seem to work as expected, so I'm not sure what I'm doing wrong. For example, this code seems to work:

    var filters = new Array();
    filters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

    var columns = new Array();
    columns[0] = new nlobjSearchColumn('tranid');

    var searchResults = nlapiSearchRecord('check', null, filters, columns); 

Anyway, any help would be appreciated. Thank you.

Share Improve this question asked Dec 7, 2016 at 17:07 user2233949user2233949 2,2431 gold badge23 silver badges23 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

checknum is not searchable. Try with otherrefnum like this:

var acct = nlapiGetFieldValue('account');
var paymentFilters = new Array();
paymentFilters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

var paymentColumns = new Array();
paymentColumns[0] = new nlobjSearchColumn('otherrefnum');

var paymentSearchResults = nlapiSearchRecord('customerpayment', null, paymentFilters, paymentColumns);

While checknum is a valid field on the customerpayment record, it's not a valid search result column.

This document outlines all of the scriptable fields for customer payments and checknum is not listed in the Search Columns section.

NetSuite Record Browser

I don't see that that Check Number is available when performing a search.

It is a rare error, because the column name is indeed correct. You could solve it like this:

var filters = new Array();
filters[0] = new nlobjSearchFilter('account', null, 'anyof', acct);

var paymentColumns = new Array();
paymentColumns[0] = new nlobjSearchColumn('internalId');

var paymentSearchResults = nlapiSearchRecord('customerpayment', null, filters, paymentColumns);

for (var i = 0; paymentSearchResults != null && i < paymentSearchResults.length; i++) {

    var customerpayment = nlapiLoadRecord('customerpayment', paymentSearchResults[i].getValue('internalId'));
    var checknum = customerpayment.getFieldValue('checknum');

    nlapiLogExecution('DEBUG', 'checknum', checknum);
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论