Can't filter by third party name if they contains ()
Bug
By calling API with URL like that:
$sqlFilter = urlencode("t.nom:=:'myThirdarty (MT)'");
callApi("api/index.php/thirdparties?sqlfilters=$sqlFilter");
You will get error Bad Request: Error when validating parameter sqlfilters -> Bad syntax of the search string.
Environment Version
18.0.5
Environment OS
Debian 12
Environment Web server
Apache 2
Environment PHP
8.1
Environment Database
mysql
Environment URL(s)
No response
Expected and actual behavior
I were using version 15.0.3. I'm actualling migrating. I want to get a third party by the login/name.
Steps to reproduce the behavior
- Create user with parenthesis in his name like
My name (MM) - Call API with URL like that:
api/index.php/thirdparties?sortfield=t.rowid&sortorder=ASC&limit=100&sqlfilters=t.nom%3A%3D%3A'MyName%20(MN)'
Attached files
Example of full query using swagger (I removed unused line) :
Interesting issue. Have you tried using the CHAR(40) solution mentioned on this page?
https://salesforce.stackexchange.com/questions/383197/escaping-parenthesis-in-sql-query-like-clause
I just tried it and it the same result:
This will work but return some unwanted result (_ is any character in MySQL)
$sqlFilter = urlencode("t.nom:=:'myThirdarty _MT_'");
and with just : (t.nom:=:'myThirdarty \(MT\)')
This will work but return some unwanted result (
_is any character in MySQL)$sqlFilter = urlencode("t.nom:=:'myThirdarty _MT_'");
We should use LIKE with this method (instead of =) ?
and with just :
(t.nom:=:'myThirdarty \(MT\)')
No, it doesn't work. I tried lot of example as showed in the link of StackExchange from Jon and it's blcoked too
We should use
LIKEwith this method (instead of =) ?
It works with = and is more close to the expected result (_ is only one of any character, % is one or many characters)
We should use
LIKEwith this method (instead of =) ?It works with
=and is more close to the expected result (_is only one of any character,%is one or many characters)
I just tried and for me it doesn't works with =.
- With
t.nom:=:'myThirdarty _MT_'-> no result found. So it's better, I no longer have error. - With
t.nom:LIKE:'myThirdarty _MT_'-> Result found - I try by adding
myThirdarty MTandmyThirdarty aMTato see the result, and tryt.nom:LIKE:'myThirdarty _MT_'and I got 2 result : The right one (with(MT)) and with a (aMTa)