Hi,
We have scenario that custom field having values like below,
Field Name: months
Record1 - Jan,Mar
Record2 - Mar, Dec
Record3 - Feb,Jul
so when i am trying to query via rest api, I need to use comma to separate multiple values. since comma is already present in the values, its not picking any records. How to escape commas in values?
Please help.
Solved! Go to Solution.
Not so much a query string issue as a general delimiter collision issue (which would exist even if the value were, say, a JSON String).
Unfortunately I’m not aware of a way of escaping the comma delimiter. For fields storing multiple nested values, it’s recommended that you use semicolons (as Marketo does for fields linked to Selects, for example). Perhaps you can export and reimport these values and use the semicolon going forward.
@cptizo ,
If you google how to URL encode a comma, you'll find things like this.
In short, use %2C instead of comma in a URL. That being said, any good URL building library should handle that automatically for you.
Cheers,
Jo
In short, use %2C instead of comma in a URL. That being said, any good URL building library should handle that automatically for you.
That won’t actually work. The problem isn’t that the comma is a reserved character in a URL, it’s that a reserved character within the Marketo app. So either way Marketo sees a comma.
Not so much a query string issue as a general delimiter collision issue (which would exist even if the value were, say, a JSON String).
Unfortunately I’m not aware of a way of escaping the comma delimiter. For fields storing multiple nested values, it’s recommended that you use semicolons (as Marketo does for fields linked to Selects, for example). Perhaps you can export and reimport these values and use the semicolon going forward.
Agreed, there probably isn’t any way to get around this other than changing the delimiter character in the field value. I spent some time in going through similar use-case and tried all the possible way to escape the “,” character and send it in the request URL in a way so that Marketo considers the comma delimited value as a single value, but none seemed to be working.