Hi,
I'm hoping this is not a serious problem and something dumb on our part. Whenever a cash sale or invoice is received, we are running the following code (partial snippet):
function processOrder(order) {
var body='';
body += '<order>';
// get the customer's site id.
var customer = nlapiLoadRecord('customer',order.getFieldValue('entity'));
var siteid=0;
if(customer!=null)
siteid=customer.getFieldValue('custentityvsiteid');
var query = '';
// if we have a valid siteid
if((siteid!=null)&&(siteid>1)) {
// start building the querystring
body += '<siteid>'+siteid+'</siteid>';
// iterate the line items in the cash sale.
var itemCount = order.getLineItemCount('item');
for ( it = 1 ; it<= itemCount ; it++ ) {
body += '<item>';
// get all the variables we are going to need.
var quantityremaining = order.getLineItemValue('item', 'quantityremaining', it);
var quantityfulfilled = order.getLineItemValue('item', 'quantity', it);
var quantity = 0;
if((quantityremaining!=null)&&(quantityfulfilled!=null))
quantity = quantityremaining+quantityfulfilled;
var itemordered = order.getLineItemValue('item','item',it);
var dstart = order.getLineItemValue('item','revrecstartdate',it);
var dend = order.getLineItemValue('item','revrecenddate',it);
body += '<product>'+itemordered+'</product>';
body += '<quantityremaining>'+quantityremaining+'</quantityremaining>';
body += '<quantityfulfilled>'+quantityfulfilled+'</quantityfulfilled>';
if(dstart!=null) {
body += '<datestart>'+dstart+'</datestart>';
body += '<dend>'+dend+'</dend>';
}
body += '</item>';
}
body += '</order>';
}
Here's the problem: Every so often, and VERY randomly, the quantityfulfilled is returning null. Now, if I go look at the cash sales after it's been saved, I clearly see a partial value (like .75). And worse, if I just click edit->save, to reexecute the above code, it seems to work.
This seems to be completely random, but is not working more often than it does. Any thoughts from Netsuite or the Netsuite community would be much appreciated.
thanks,
jasen