SOLVED

Re: Field with Multiple values

Go to solution
Yash
Level 4

Field with Multiple values

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Field with Multiple values


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.)

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Field with 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.

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
Level 4

Re: Field with Multiple values

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
Level 10 - Community Moderator

Re: Field with Multiple values


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.)

Yash
Level 4

Re: Field with Multiple values

Thanks @SanfordWhiteman !