CMS Development

MBujak
Member

Special Characters in crm_objects query

SOLVE

I have a question about query crm objects when the value of the specific property contains special characters. In this case it's ampersand (&).
I have custom property, which is multiple checkboxes type, and one of the value is "Disinfectants & Solutions" - so it contains whitespaces and ampersand:

MBujak_0-1723291818850.png


In the module on the page user can filter products by this property. And it works fine for values without special characters. But for this value with ampresand it always returns 0 results even when there are products with these values assigned.
My code is this:

MBujak_1-1723291835140.png
The final query is:
"limit=100&offset=0&emea__eu____product_line__contains=Disinfectants & Solutions"
and it returnes 0 results.
The query for other value like this:
"limit=100&offset=0&emea__eu____product_line__contains=Mops"
works fine and return the correct rows collection.

Is there a way to query for the value with the special characters in it and get correct results?

0 Upvotes
1 Accepted solution
evaldas
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Special Characters in crm_objects query

SOLVE

@Jaycee_Lewis that seens logical and was my initial though too but does not look like that works.

 

I was not able to locate any documentation regarding special characters and it would be great to know whether special characters can be used at all.

 

It appears that spaces are allowed and there is one workaround that will work as long as the other options do not contain the same words:

 

"limit=100&offset=0&emea__eu____product_line__contains=Disinfectants Solutions"

 

This would return items that contain "Disinfectans & Solutions" but it would also return items that contain "Desinfectants & Cleaning Solutions" 

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

Special Characters in crm_objects query

SOLVE

Hey, @MBujak 👋 I think you need to handle the spaces and special character. Have you tried something like this? 

"limit=100&offset=0&emea__eu____product_line__contains=Disinfectants%20%26%20Solutions

 

Talk soon! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
evaldas
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Special Characters in crm_objects query

SOLVE

@Jaycee_Lewis that seens logical and was my initial though too but does not look like that works.

 

I was not able to locate any documentation regarding special characters and it would be great to know whether special characters can be used at all.

 

It appears that spaces are allowed and there is one workaround that will work as long as the other options do not contain the same words:

 

"limit=100&offset=0&emea__eu____product_line__contains=Disinfectants Solutions"

 

This would return items that contain "Disinfectans & Solutions" but it would also return items that contain "Desinfectants & Cleaning Solutions" 

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.