Field with Multiple values | Community
Skip to main content
New Participant
November 25, 2020
Solved

Field with Multiple values

  • November 25, 2020
  • 1 reply
  • 5491 views

We need to attribute multiple values to one of the fields. As far as what I know we would either use semicolon (;) or comma (,) to separate multiple values. In our scenario one of the values by itself has a comma in it and wasn't sure how to escape that comma that exists in the field value. Please advise, thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

I would just need to concatenate these values and assign it to a field. As you can see here the fist value has a comma in it and wasn't sure how to escape that.

It's up to you how to escape it, since you're using a format that Marketo internally knows nothing about. If you want to create a CSV row, then a comma is typically escaped by enclosing each value in double quotes.

 

As mentioned, Marketo only has special treatment of semicolon-delimited Strings. (And even there the special treatment is restricted to forms + syncing with SFDC picklists.)

1 reply

SanfordWhiteman
New Participant
November 25, 2020

In our scenario one of the values by itself has a comma in it and wasn't sure how to escape that comma that exists in the field value.

There's only one implicitly-standard delimiter within Marketo, the semicolon.  But this only applies when you have a String or Text Area field that you want to present on a form using the Checkboxes or Select Multiple input types. Otherwise, a string is just a whole string, it's not natively treated as a list of substrings.

 

So if you're not talking about the form side — and keep in mind you can transform any storage format into Checkboxes using custom JS, the Forms 2.0 library will do it for you automatically if you use a semicolon — then you can use any delimiter you want. I recommend you use something that can be guaranteed to not having a delimiter collision within your domain. In other words, define ahead of time that a valid substring value cannot contain a semicolon (this is how browser cookies work, btw).

 

If you can't enforce a collision-free delimiter, then use something established, like a JSON Array or URL-encoded query string. Don't try to create your own format and escaping rules.

Yash-3Author
New Participant
November 26, 2020

Thanks @sanfordwhiteman !

My apologies if I was unclear. The context is a bit different here-would need to manually push multiple values to a field in Marketo.

Scenario: 

Value 1: ABC,EFG

Value 2: XYZ

I would just need to concatenate these values and assign it to a field. As you can see here the fist value has a comma in it and wasn't sure how to escape that.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
November 26, 2020

I would just need to concatenate these values and assign it to a field. As you can see here the fist value has a comma in it and wasn't sure how to escape that.

It's up to you how to escape it, since you're using a format that Marketo internally knows nothing about. If you want to create a CSV row, then a comma is typically escaped by enclosing each value in double quotes.

 

As mentioned, Marketo only has special treatment of semicolon-delimited Strings. (And even there the special treatment is restricted to forms + syncing with SFDC picklists.)