How can I modify the vendor purchase prices multip...
# ask-stanley-ai
j
How can I modify the vendor purchase prices multiple currencies value with scripts?
c
AI generated answer (using internal Slack threads):
To modify the vendor purchase prices for multiple currencies with scripts, you need to use the SuiteScript API. The vendor-specific purchase prices are stored in a sublist on the item record. You can access and modify these values using the
findSublistLineWithValue
and
setSublistValue
methods. Here is a sample script that was used before multi-currency was enabled:
Copy code
javascript
const preferred_vendor_line = itemRecord.findSublistLineWithValue({
    sublistId: 'itemvendor',
    fieldId: 'preferredvendor',
    value: true
});

itemRecord.setSublistValue({
    sublistId: 'itemvendor',
    fieldId: 'purchaseprice',
    line: preferred_vendor_line,
    value: parseFloat(price || '0').toFixed(2)
});

itemRecord.save({
    ignoreMandatoryFields: true
});
However, when multi-currency is enabled, the vendor purchase prices are stored in a different way. The currency of the vendor is also taken into account. If the vendor is a multi-subsidiary vendor or if the vendor's currency is different from the subsidiary's currency, the vendor purchase price will be displayed with the currency code (e.g., "USA: $5"). Unfortunately, the exact method to modify the vendor purchase prices for multiple currencies with scripts is not provided in the conversations. You may need to explore the SuiteScript API documentation or the NetSuite Help Center for more information. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850290477
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831408858
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82983321
Please provide your feedback on this answer.