How can I set a data field to NULL from a webhook? | Community
Skip to main content
Level 4
May 24, 2016
Question

How can I set a data field to NULL from a webhook?

  • May 24, 2016
  • 1 reply
  • 2265 views

Is this possible?

Let's say I have a field named HighestScoredCategory and I update that with a webhook that returns JSON such as {"categoryName":"Invitations"} that writes categoryName to HighestScoredCategory.

Is it possible to return something like {"categoryName":null}, to clear the contents of HighestScoredCategory as if I set it to NULL from Marketo? All of the following seem to be ignored:

{"categoryName":null}

{"categoryName":NULL}

{"categoryName":"NULL"}

{"categoryName":false}

These actually set the string literally (as you might expect, but it was worth trying):

{"categoryName":"null"}

{"categoryName":"[null]"}

My current workaround is to return None and add a flow step to update None to NULL. This works fine, but isn't ideal since depends on manual steps from marketing and might not happen everywhere it should.

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

1 reply

SanfordWhiteman
Level 10
May 24, 2016

Don't you actually mean empty string -- "" -- and not Marketo's magical use of the case-sensitive string "NULL" to mean empty this field?

Jon_WuAuthor
Level 4
May 25, 2016

I just want to empty the field.

Whether that means it's technically empty or null in the database is related, but I want to do the equivalent of Marketo's magical use of the case-sensitive string NULL. I think this actually does set the field to a null value on the backend since the activity log shows the change from None to [null] when using my workaround.

Your comment reminds me that I forgot to mention that this doesn't work either:

{"categoryName":""}

SanfordWhiteman
Level 10
May 26, 2016

Don't trust [null] to really be ANSI SQL NULL because there are some datatypes that will set the default even though they say [null]. Let me see what we're doing with clearing a field.  I can't believe we aren't doing that in any of our webhooks.