Attachable upload filename is null
Since 2 Oct, when we upload a file to QuickBooks and map it to a bill, the QBO display filename is blank. I suggest add FileName when updateAttachable. Can you review it?
QuickBooks.prototype.upload = function(filename, contentType, stream, entityType, entityId, callback) { var that = this var opts = { url: '/upload', formData: { file_content_01: { value: stream, options: { filename: filename, contentType: contentType } } } } module.request(this, 'post', opts, null, module.unwrap(function(err, data) { if (err || data[0].Fault) { (callback || entityType)(err || data[0], null) } else if (_.isFunction(entityType)) { entityType(null, data[0].Attachable) } else { var id = data[0].Attachable.Id that.updateAttachable({ Id: id, SyncToken: '0', **FileName: filename,** AttachableRef: [{ EntityRef: { type: entityType, value: entityId + '' } }] }, function(err, data) { callback(err, data) }) } }, 'AttachableResponse')) }
Also experiencing the same thing.
We are also having this issue. It seems like this was updated recently in the API. The update to attachable now expects all fields in the update body. See https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/attachable#full-update-an-attachable
In the meantime we are using this workaround:
qbo.upload(
"Invoice Details.pdf",
"application/pdf",
pdfStream,
(err, attachable) => {
if (err) {
// ...handle error
}
qbo.updateAttachable({
...attachable,
SyncToken: '0',
AttachableRef: [{
EntityRef: {
type: "Invoice",
value: qboInvoice.Id + ''
}
}]
}, (err, attachable) => {
});
}
);
Found this issue on my side as well, I tried to fix this using patch-package right now, but also create a Pull Request to this repository related to the issue.
https://github.com/mcohen01/node-quickbooks/pull/246
Thanks @saalihou for the information!