Hi, by opt-in field are you referring to the default Marketo "unsubscribed" field? or did you create a custom field? And is the field type in admin=>field management for this field "string"?
Going by what you have shared, if the field type is still boolean in field management, no matter what type of field you use in a form, the data will adhere to standards of the field type set in field management. And boolean fields can only have 2 options - 0 or 1 / Yes or No / True or False. Empty/blank/null is different to false/no/0
Create and use a custom field that's a string type to achieve what you want. Just bear in mind, if a value already exists in the field and the field is submitted again "unchecked", Marketo won't clear the field. You'll need to force the field to pass a NULL value through to clear the field.
It's a custom field with the datatype of String. I guess that wasn't clear in my original post.
Please confirm if I'm understanding correctly:
Field has never been checked before:
Unchecked after being checked:
No/False/0 => but you don't want this. You would like it to still be Yes/True/1
One way to achieve the above is with a smart campaign + a proxy field:
Create another field to be used in the form (a proxy field and this can be a boolean), and switch it with the opt-out field in your form
Smart campaign Smart list
Trigger: Data value changes "proxy field"
New value "True"
Smart campaign Flow
Change data value with choice
Choice 1 if "opt-out" is empty
attribute "opt-out" new value "Yes"
default choice do nothing
Can only run through once
This cannot be a "run through once" deal because people need to be able to opt in and opt out as many times as they want.
4 of 4 people found this helpful
This is in fact a bug in the forms library.
You're absolutely right that it's not the intended behavior with Checkboxes fields, which should assemble a semicolon-delimited string containing values only of checked inputs. Unchecked inputs should not be included in the string, and a synthetic string value "no" should not be created.
The reason you're seeing the bug is that you're using the literal server value "yes" in lower case. If you use the server value "YES" in upper case (or "yeah" or another meaningful string) the bug isn't triggered.
I want the value to be NULL if there's no action.
Actually, you want the value to be the empty string if there's no action. The four-letter string "NULL" will empty the stored value, while the empty string will not change the stored value. If you don't use literal "yes" then you'll get the expected outcome.
Fantastic. So I can use anything but yes in lower case. Brilliant.