I need to get a lookup fields value from a line item on an SO and then update the corresponding line item in a PO. Fetching the value is not a problem, I'm using
newSite = record.getSublistValue("item", "custcol_site", lineNum)
to get the value - this returns the id of the lookup field object. However when I then try to update the field value on the PO using
loadedTransaction.setSublistValue({
sublistId: "item",
fieldId: "custcol_site",
value: newSite,
line: lineNum
});
Nothing happens, I don't get an error, however the field doesn't update either. How can I update the field using this ID value I've already fetched?
I'm also updating a number of other fields without issue following the same pattern, it's only the lookup field that's not updating successfully, so "lineNum" and fieldIds are not the problem as far as I can tell, I must just not be sending the correct information to update the lookup, however I can't find somewhere to tell me what information to send through.
Inferring from the name
loadedTransactionthat you have calledrecord.load()to retrieve that reference, you'll also need to then callloadedTransaction.save()to commit your changes to the database.