Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Auto Fulfill Drop Ship POs
I want to autofulfill drop ship POs... I thought I had it working, but somehow the fulfillment items are not tied to the PO. It works correctly if I create the fulfillment in the UI, but using nlapiTransformRecord, it fulfills from our stock, creating negative quantities.
Do I need to manually set that it is a drop shop PO? The UI does this automatically.
Here's the Code that gets run on a Drop Ship PO Save Record Function:
function dropShipSaveRecord() { var id=nlapiGetFieldValue('createdfrom'); if(id) { var items=new Array(); for(var i=1;i<= nlapiGetLineItemCount('item');i++) { items[nlapiGetLineItemValue('item','item',i)]=nlapiGetLineItemValue('item','quantity',i); } var fulfillRecord = nlapiTransformRecord('salesorder', id, 'itemfulfillment'); fulfillRecord.setFieldValue('generateintegratedshipperlabel','F'); for(var i=1;i<= fulfillRecord.getLineItemCount('item');i++) { var itemid=fulfillRecord.getLineItemValue('item','item',i); if(items[itemid]) { fulfillRecord.setLineItemValue('item','itemreceive',i,'T'); fulfillRecord.setLineItemValue('item','quantity',i,items[itemid]); } else { fulfillRecord.setLineItemValue('item','itemreceive',i,'F'); } } try{ nlapiSubmitRecord( fulfillRecord ); } catch(e) { var errorTxt='Error creating fulfillment: '+e.code+': '+e.message; alert(errorTxt); } } return true; } 0