Forum Discussion
Check if date field from MS Forms is empty in Power Automate
Tonje Waasjø SharePoint actions like "Create Item" are funny because while you can use the expression "null" to clear data from a date field, or simply leave a date field blank (in which case it will end up null), you will get an error if you try to pass a null value into the action, such as from a variable or a Forms response.
So what you can do is use an "If" expression to evaluate the date value received from Forms:
- If the date value is found to be empty, use null
- Otherwise, use the value from Forms
The expression in the screenshot is:
if(equals(variables('varFormsDate'),''),null,variables('varFormsDate'))
Here "varFormsDate" is a string variable that has been set to the date value from Forms. You don't have to set a variable first, you can work directly with the value received from Forms if you prefer, but it does make expressions a little easier to read 😃
FYI this approach also works with other types of columns that are finicky about receiving null values, like URL columns.