Null as field value | Community
Skip to main content
Yaron_Meiner
New Participant
May 6, 2020
Question

Null as field value

  • May 6, 2020
  • 2 replies
  • 3558 views

I had a user that filled a form with "null" as the company name. Since i am not using embedded marketo forms but backend submission, the value of the company name was null. even if i sanitize the field, the value is still null because it's a valid string. The result of it was that the company name stayed empty and the lead did not sync into SF because of the mandatory field requirement.

 

I have a way to validate and return an error to the user on form field globally in code but i wanted to use the smarts of the nation and see if there is a better way to resolve this. Please feel free to bash me for bad behavior if exists.

 

Yaron

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

2 replies

SanfordWhiteman
New Participant
May 6, 2020

Not sure I see the problem?

 

All form field values are strings in transit: unlike JSON properties, they're not typed unless the back end decides that some have special meaning, like Marketo also does with  NULL.

 

If you want to avoid the system-special values you'd need to create your own special value, like [N/A].

Yaron_Meiner
New Participant
May 7, 2020

I understand that but what happens when the user decides to put 'null' in one of the fields?

The two solutions here, in my opinion, can be:

  1. As suggested - to replace the value of the field to something else. [n/a] might be a good solution because it keeps the field with some value. this can be done either with a smart campaign or with a piece of code 
  2. My preferred action - to return to form on validation level or mark to the user that they have to put a real company name (and risk that NULL inc is not using a shortened brand name)

I would actually want to see it as a functionality of the embedded forms. 

Yaron_Meiner
New Participant
May 6, 2020

I just tested it, it happens also with embedded Marketo forms...