I’m trying to sync ERPnext with MYOB AccountRight Live using n8n - specifically update a field called custom_myob_uid
in my Item doctype. I am trying to PUT using the below code:
const items = $input.all()[0].json.Items;
return items
.filter(item => item.Number) // Ensure only items with a Number are processed
.map(item => ({
json: {
method: 'PUT',
url: 'https://[hostname]/api/resource/Item/' + encodeURIComponent(item.Number),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: {
custom_myob_uid: item.UID
}
}
}));
Running this should output the returned data, but it is not updating anything, and I get this as the response:
{
"method": "PUT",
"url": "https://[hostname]/api/resource/Item/[item ID]",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": {
"custom_myob_uid": "[valid UID]"
}
},
But viewing the form itself does not show me the data. Is there something I’m doing wrong?