The following script worked prior to Friday's upgrade to 2009.2.
The script is setting a custom field on the Item Fulfillment record. This script DOES work when fulfilling a single sales order.
The script fails when doing batch fulfilling. The field is never populated. I thought maybe there was a new "type" field for batch stuff but I have not found it. Maybe I need to use xedit but have not put it in the debugger yet. I plan to do so later today.
My other thought is the drop ship po aspect as changed.
Any ideas:?
function beforeSubmitSetIntegrationStatus(type)
{ vversion='1.00'
nlapiLogExecution("Debug", "beforeSubmitSetIntegrationStatus",
"Version="+
vversion);
nlapiLogExecution("Debug", "beforeSubmitSetIntegrationStatus",
"type="+
type);
//Only execute on the creation of item fulfillment
if ( type != 'create')
{
return true;
}
//Load new record
var tranRecord = nlapiGetNewRecord();
if (tranRecord==null)
{
return true;
}
nlapiLogExecution("Debug", "beforeSubmitSetIntegrationStatus",
"tranid="+
tranRecord.getFieldValue('tranid'));
//if the status of new item fullment is not Picked, it must be a drop ship.
if (tranRecord.getFieldValue('shipstatus')!='A')
{
return true;
}
//if the first line in the item list has create PO != null, then it is a drop ship PO
if (tranRecord.getLineItemValue('item', 'createpo',1)!=null)
{
return true;
}
//if either null or blank, set value to 1 which equals "Open"
if (tranRecord.getFieldValue('custbody_integration_status') == null || tranRecord.getFieldValue('custbody_integration_status') == '') {
tranRecord.setFieldValue('custbody_integration_status', 1);
}
}