Best answer

Set an input to NULL

  • 28 July 2023
  • 2 replies
  • 474 views

Userlevel 1
Badge

Is there a way to set a Zap’s input’s value to NULL?  For example, I’d like to clear the contents of the Notes field when a Zap is run (in addition to other modifications).

icon

Best answer by connorz 2 August 2023, 20:12

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 3
Badge +6

Hi @craibuc,

Great question!

To be clear, it’s not possible for a user to map null into an input field. For context, this is because the Zap editor ignores null to avoid unexpected side effects.

However, while users cannot map null into the editor, you can certainly still send null your trigger or action’s API request.

With that in mind, there are a few approaches that might be helpful. 

First, if you only want to clear the Notes field when it has no input, before making the API request, you can check the value of the field and conditionally send null.

Second, if you want to give users a way to specify that the field should be cleared, you can pick an arbitrary string to use for that purpose. For example, you could use something like $$CLEAR$$ and include help text under the field, telling the user to enter this string if they want to clear the field. Then, in the request, you can check if the field’s value matches the clearing-string and conditionally send null.

Does this give some ideas?

Userlevel 1
Badge

Thanks for the idea.

It would be nice if you had a token like {{zap_null}}, similar to {{zap_meta_human_now}}.