Here's the dealio...I had some custom scripts written for our company and they've been working well for 7 months, then all of a sudden we are having a weird issue...
We have Auctions and accept bids...We generally have over 1,000 lots in our auctions and this month we have 1284.
For reasons beyond my comprehension, we can not "find" lots 743 thru 999.
If I change the variable custitemlot in the non-inventory item record from 743 to 1285, the script then works to pull up that item's data...Any ideas, comments, questions would be welcome...
If someone tries to submit a bid on lots 743 thru 999, the error received on our webstore is as follows:
TypeError: Cannot call method "substring" of null (TCWC_BidSlip.js#212)
Here's the script that looks for the lot:
function FindItemByLot(request,response)
{
if ( request.getMethod() == 'GET' )
{
var param_lot = request.getParameter('custpage_param_lot');
var filters = new Array();
filters[0] = new nlobjSearchFilter('custitemlot',null,'is',param_lot);
var columns = new Array();
columns[0] = new nlobjSearchColumn('displayname');
columns[1] = new nlobjSearchColumn('custitemlot');
columns[2] = new nlobjSearchColumn('custitemauction_end_date');
columns[3] = new nlobjSearchColumn('custitemauction_qty');
columns[4] = new nlobjSearchColumn('custitembottle_size');
columns[5] = new nlobjSearchColumn('storedescription');
columns[6] = new nlobjSearchColumn('custitemlot_condition');
columns[7] = new nlobjSearchColumn('custitemrating_text');
columns[8] = new nlobjSearchColumn('custitemrating_text_wsscore');
columns[9] = new nlobjSearchColumn('custitemlow_estimate');
columns[10] = new nlobjSearchColumn('custitemhigh_estimate');
var item_record = nlapiSearchRecord('item',164,filters,columns);
for(var i=0; item_record != null && i < item_record.length; i++)
{
var item_name = item_record[i].getValue('displayname');
var item_lot = item_record[i].getValue('custitemlot');
var item_auction_end_date = item_record[i].getValue('custitemauction_end_date');
var item_auction_qty = item_record[i].getValue('custitemauction_qty');
var item_bottle_size = item_record[i].getValue('custitembottle_size');
var item_bottle_sizeid = item_record[i].getValue('custitembottle_size');
var item_description = item_record[i].getValue('storedescription');
var item_lot_condition = item_record[i].getValue('custitemlot_condition');
var item_wa_rating = item_record[i].getValue('custitemrating_text');
var item_ws_rating = item_record[i].getValue('custitemrating_text_wsscore');
var item_low_est = item_record[i].getValue('custitemlow_estimate');
var item_high_est = item_record[i].getValue('custitemhigh_estimate');
if (item_lot == param_lot)
{
response.addHeader('Custom-Header_itemfound','T');
response.addHeader('Custom-Header_item_name',IsNull(item_name));
response.addHeader('Custom-Header_item_auction_end_date',IsNull(item_auction_end_date));
response.addHeader('Custom-Header_item_auction_qty',IsNull(item_auction_qty));
response.addHeader('Custom-Header_item_bottle_size',IsNull(item_bottle_size));
response.addHeader('Custom-Header_item_bottle_sizeid',IsNull(item_bottle_sizeid));
response.addHeader('Custom-Header_item_description',IsNull(item_description));
response.addHeader('Custom-Header_item_lot_condition', IsNull(item_lot_condition));
response.addHeader('Custom-Header_item_wa_rating',IsNull(item_wa_rating));
response.addHeader('Custom-Header_item_ws_rating',IsNull(item_ws_rating));
response.addHeader('Custom-Header_item_low_est',IsNull(item_low_est));
response.addHeader('Custom-Header_item_high_est',IsNull(item_high_est));
response.write('Custom-Header_itemfound T' + '<br>');
response.write('Custom-Header_item_name '+ IsNull(item_name) + '<br>');
response.write('Custom-Header_item_auction_end_date ' + IsNull(item_auction_end_date) + '<br><br>This lot contains: ');
response.write('Custom-Header_item_auction_qty ' + IsNull(item_auction_qty) + '<br>');
response.write('Custom-Header_item_bottle_size ' + IsNull(item_bottle_size) + '<br>');
response.write('Custom-Header_item_bottle_sizeid ' + IsNull(item_bottle_sizeid) + '<br>');
response.write('Custom-Header_item_description ' + IsNull(item_description) + '<br>');
response.write('Custom-Header_item_lot_condition ' + IsNull(item_lot_condition) + '<br>');
response.write('Custom-Header_item_wa_rating ' + IsNull(item_wa_rating) + '<br>');
response.write('Custom-Header_item_ws_rating ' + IsNull(item_ws_rating) + '<br>');
response.write('Custom-Header_item_low_est ' + IsNull(item_low_est) + '<br>');
response.write('Custom-Header_item_high_est ' + IsNull(item_high_est) + '<br>');
}
}
}
}
function IsNull(str)
{
if (str == null)
{
return "";
}
else
{
return str;
}
}