I am trying to query the invoices with xero-ruby gem. I need to query with reference. I build the query options as
opts = { statuses: %w[PAID DRAFT SUBMITTED AUTHORISED], where: { reference: ["Contains", job.quote_ref] } }
But on production it returns the following error:
Where clause invocation error: Operations on optional fields must be preceded by a null guard, e.g. \"[FieldName] != null AND [FieldName]...\""
I tried to add the null condition like this:
opts = { statuses: %w[PAID DRAFT SUBMITTED AUTHORISED], where: { reference: ["!=", nil] && ["Contains", job.quote_ref] } }
But since it is a hash, && condition doesn't work and it sends only the contains part.
I need help as Xero support does't help with ruby related issues
Tried building the query with multiple options:
opts = { statuses: %w[PAID DRAFT SUBMITTED AUTHORISED], where: { reference: ["!=", nil, "AND","contains", "1814"] }}
Not able to find a solution for this