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
Custom Field Filtering Flexibility
Forum rules
- Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
- No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
- Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
- Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
- Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
- Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
- Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
- Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
-
JackEcuyer
- Posts: 22
- Joined: Tue Mar 12, 2024 3:32 pm
-
JackEcuyer
- Posts: 22
- Joined: Tue Mar 12, 2024 3:32 pm
Re: Custom Field Filtering Flexibility
Filtering by Value=null appears to be working for what I need, are there any other methods?
-
SimproAPITeam
- Posts: 831
- Joined: Wed May 01, 2024 2:31 am
Re: Custom Field Filtering Flexibility
Hi JackEcuyer,
Using null is the correct way of filtering custom fields that does not have a value yet.
Regards
Using null is the correct way of filtering custom fields that does not have a value yet.
Regards
Simpro API Team | Simpro Software Group
-
JackEcuyer
- Posts: 22
- Joined: Tue Mar 12, 2024 3:32 pm
Re: Custom Field Filtering Flexibility
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.
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.
-
SimproAPITeam
- Posts: 831
- Joined: Wed May 01, 2024 2:31 am
Re: Custom Field Filtering Flexibility
Hi Jack,
See if these query parameters work for you.
Regards
See if these query parameters work for you.
Code: Select all
/sites/?CustomFields.CustomField.ID={id}&CustomFields.Value!=nullSimpro API Team | Simpro Software Group
DEVELOPER CENTER