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.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
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