0

We have a SuiteApp which updates NetSuite inventory item records from an external feed of distributor products, prices and availability.

This works perfectly until we encounter a site which has the Multi-Currency Vendors feature enabled.

With this feature enabled, setting the 'purchaseprice' field on the 'itemvendor' list no longer causes the purchase price to be updated (although no errors are returned).

I have tried using setLineItemValue() and using selectLineItem(), setCurrentLineItemValue(), commitLineItem() with both the purchaseprice and the vendorprices fields but cannot make this work.

How should we update the vendor purchase price on an item vendor line for an existing inventory item record, when the Multi-Currency Vendors feature is enabled?

Our code

        var inventoryItem = nlapiLoadRecord('inventoryitem', 109430);
        inventoryItem.selectLineItem('itemvendor', 1);      
        inventoryItem.setCurrentLineItemValue('itemvendor', 'purchaseprice',10.99);
        inventoryItem.commitLineItem('itemvendor');
        nlapiSubmitRecord(inventoryItem);

Thanks,

lavb
  • 618
  • 7
  • 20
  • I recivied this respond from NetSuite.com: Upon further investigation, the feature to set the Purchase Price field using SuiteScript while the Multi-Currency Vendors is enabled is still not available to NetSuite. However, I have found an existing Enhancement Request for this. I will be sending you the Ticket Number and the details of this enhancement on my next email. – lavb Sep 18 '15 at 20:00

1 Answers1

2

We find a simple solution, we delete first the vendor entry information and reinsert again the entry with the new cost.

    var inventoryItem = nlapiLoadRecord('inventoryitem', 109430);
    inventoryItem.removeLineItem('itemvendor', 1);

    inventoryItem.setLineItemValue('itemvendor', 'vendor', 1, 976);
    inventoryItem.setLineItemValue('itemvendor', 'preferredvendor', 1, 'T');
    inventoryItem.setLineItemValue('itemvendor', 'vendorcode', 1, 'PL244 Black');
    inventoryItem.setLineItemValue('itemvendor', 'purchaseprice', 1, 11.99);

    nlapiSubmitRecord(inventoryItem);
lavb
  • 618
  • 7
  • 20