I have 100 items that are available in two subsidi...
# ask-stanley-ai
s
I have 100 items that are available in two subsidiaries that need the purchase price of the vendor updated - but we use the same vendor in both subsidiaries. When performing a CSV to update, I receive the error "Vendor/Subsidiary must be unique". How can I update the vendor purchase price for items where there is a vendor for both subsidiaries?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** The error you're encountering is due to the fact that NetSuite does not allow updating the purchase price directly on the vendor sublist. Instead, the purchase price is represented by a subrecord. Here's how you can update the purchase price: 1. Select the line you want to update using
selectLine()
. 2. Get the subrecord using
getCurrentSublistSubrecord()
. 3. Update the price on the subrecord. Here's a code snippet that demonstrates this:
Copy code
javascript
itemRecord.selectLine({
    sublistId: 'itemvendor',
    line: i
});

var vendorSubrecord = itemRecord.getCurrentSublistSubrecord({
    sublistId: 'itemvendor',
    fieldId: 'itemvendorprice'
});

vendorSubrecord.setValue({
    fieldId: 'vendorprice',
    value: tradePrice
});

itemRecord.commitLine({ sublistId: 'itemvendor' });
In this code snippet,
itemvendor
is the sublistId for the vendor sublist,
i
is the line number you want to update, and
tradePrice
is the new purchase price. Please note that the purchase price is on the
itemvendorpricelines
sublist of the subrecord, with each line representing a different currency. You may need to iterate over this sublist to find the line with the correct currency before updating the price. Remember to save the record after making these changes.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856624544
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856004715
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85497117
Please provide your feedback on this answer.