Jared Fraley
09/26/2024, 6:58 PMCeligo AI
09/26/2024, 6:58 PMAI generated answer (using internal Slack threads):The vendor purchase price is not being updated through REST because when multi-currency is enabled, the vendor purchase price is not directly a field on the vendor sublist. Instead, it is represented by a subrecord. This is why you are able to set the vendor purchase price when adding a new vendor, but not when trying to update an existing vendor's purchase price. In the UI, you would click a button to edit a subrecord. The same process needs to be followed in the script. You need to select the line, get the current sublist subrecord, and then set the value. Here is a sample code snippet that demonstrates this:
javascript
itemRecord.selectLine({
sublistId: vendorSublist,
line: i
});
var vendorSubrecord = itemRecord.getCurrentSublistSubrecord({
sublistId: 'itemvendor',
fieldId: 'itemvendorprice'
});
vendorSubrecord.setValue({
fieldId: 'vendorprice',
value: tradePrice
});
itemRecord.commitLine({ sublistId: vendorSublist });
In this code, vendorSublist
is the ID of the vendor sublist, i
is the line number, and tradePrice
is the new purchase price.
Remember, the price is on the itemvendorpricelines
sublist, with each line representing a different currency, the same as the subrecord in the UI.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
09/26/2024, 6:59 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810897529
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810768306
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807248771
Celigo AI
09/26/2024, 6:59 PM