So I have a scheduled script that runs nightly. The basic process of this script is that it looks at a saved search and then runs a fulfillment process on the resulting sales orders. The only issue is when it fulfills the order for a customer who is over their credit limit, it returns a User Error and stops the script from running any more. My brain is sort of cooked when it comes to scripting so is there a way it can either a) log the error and continue or b) disable the enforcement of credit limits for the script. I'd prefer the second option to make this script automatic.
Thanks in advance for your help. My code is below:
//Bring in the saved search results var arrSearchResults = new Array(); arrSearchResults = nlapiSearchRecord('salesorder','customsearch19',null,null); //Fulfill the Orders for (var i=0; i<arrSearchResults.length; i++ ) { var id = arrSearchResults[i].getId(); var fulfillRecord = nlapiTransformRecord('salesorder', id, 'itemfulfillment'); var lineItemCount = fulfillRecord.getLineItemCount('item'); for(var x=1; x<=lineItemCount; x++) { fulfillRecord.setLineItemValue('item', 'itemreceive', x, 'T'); } nlapiSubmitRecord(fulfillRecord); }