Page 1 of 1

Custom Field Filtering Flexibility

Posted: Wed Oct 09, 2024 1:49 pm
by JackEcuyer
I'm trying to filter out invoices from the api/v1.0/companies/0/invoices/ endpoint that have a certain value on an invoice custom field, however when I filter using a custom field, only invoices that have a value assigned for that custom field are returned.

This is an example of what I'm trying to achieve and the issue I'm having :
There are 100 invoices returned in a simple api/v1.0/companies/0/invoices/ GET request.
I want to retrieve every invoice out of these 100 invoices that don't have a value of 'TEST' assigned to the text custom field ID 1.
When I try to filter out invoices with this custom field value of 'TEST' using
api/v1.0/companies/0/invoices/?CustomFi ... e=ne(TEST),
I only get back invoices that have an alternative value on the text custom field with ID 1, not invoices that simply haven't got a value for the field.

Is there a way I can either include invoices that don't have a value assigned to the custom field in the result or instead filter out all invoices that have a value for the custom field?

Thanks, Jack

Re: Custom Field Filtering Flexibility

Posted: Wed Oct 09, 2024 2:07 pm
by JackEcuyer
Filtering by Value=null appears to be working for what I need, are there any other methods?

Re: Custom Field Filtering Flexibility

Posted: Fri Oct 11, 2024 3:52 am
by SimproAPITeam
Hi JackEcuyer,
Using null is the correct way of filtering custom fields that does not have a value yet.

Regards

Re: Custom Field Filtering Flexibility

Posted: Mon Jan 27, 2025 10:35 am
by JackEcuyer
This doesn't work how it's supposed to.
I have been trying to retrieve all sites that have a specific custom field populated

(api/v1.0/companies/0/sites/?CustomField ... e=ne(null))

however this only returns a small partial list of sites that have this custom field populated. For the rest of the sites the API recognises the custom field value as null.

I have tested this by retrieving all sites that supposedly have the custom field value set as null, and the returned records indeed have a value set in the custom field.

Re: Custom Field Filtering Flexibility

Posted: Tue Jan 28, 2025 12:38 am
by SimproAPITeam
Hi Jack,
See if these query parameters work for you.

Code: Select all

/sites/?CustomFields.CustomField.ID={id}&CustomFields.Value!=null
Regards