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

Jon_Wu
Level 4

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

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.

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

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

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

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

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

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

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.