Hi, I have attempted to write the following function to copy the purchase price to sell price when the purchase price is updated on an Item. Once I have solved this I then need to draft a function to update the purchase price from the most recent purchase order, but that's down the line for now.
itemID = zoho.inventory.getRecordsByID("items",[entered my organisation ID],"item_ID");
purchasePrice = item.get("purchase_rate");
newRate = Map();
newRate.put("rate",purchasePrice);
update = zoho.inventory.updateRecord("items",[entered my organisation ID],itemID,newRate);
info newRate;
info update;
After executing, all appears OK....
Result
Function Executed Successfully
Log Messages
java.lang.Object@4ed6233f
After executing, the Item sell price (rate) is not updated from the purchase price field (purchase_rate)
Sell Price currently set at £0.00
Purchase Price currently set at £70.00
I have then set up a Workflow to try and trigger when any field on the item is updated, however the Sell Price (rate) remains at £0.00 and it does not pull the updated purchase price (purchase_rate) of £70.00 (in this test)
Thanks in advance