node-quickbooks icon indicating copy to clipboard operation
node-quickbooks copied to clipboard

Attachable upload filename is null

Open phuongtink19bg opened this issue 4 months ago • 2 comments

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')) }

phuongtink19bg avatar Oct 08 '25 10:10 phuongtink19bg

Also experiencing the same thing.

gstburnside avatar Oct 08 '25 17:10 gstburnside

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) => {

      });
  }
);

saalihou avatar Oct 31 '25 16:10 saalihou

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!

eduardamirelly avatar Nov 11 '25 17:11 eduardamirelly