cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
amiles
New Member

Date field throwing error if blank - Power Automate

Hello 

 

I have a Flow that creates a SharePoint list item after a MS Form is submitted. The field is an "end date". If the end date is blank, I receive an error that "Input parameter 'item/EndDate' is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'."

 

Any suggestions as to how I can create an expression that will ignore the field if it is left blank? I have tried to change the list item field to single line text, but that still doesn't seem to work.

Screenshot 2021-08-30 164315.png

Thanks so much,

Abbey

1 ACCEPTED SOLUTION

Accepted Solutions
v-LilyW-msft
Community Support
Community Support

Hi @amiles 

Instead of using the date directly, you should use an expression.If 'End Date' is empty, update 'null' value into the column (to keep it empty); if it's not empty, update the actual value.

Expression:

if(equals(outputs('Get_response_details')?['body/ra66dc3ce64ec4c63af091d4ced99b95c'],''),null,outputs('Get_response_details')?['body/ra66dc3ce64ec4c63af091d4ced99b95c'])

vLilyWmsft_1-1630380537243.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-LilyW-msft
Community Support
Community Support

Hi @amiles 

Instead of using the date directly, you should use an expression.If 'End Date' is empty, update 'null' value into the column (to keep it empty); if it's not empty, update the actual value.

Expression:

if(equals(outputs('Get_response_details')?['body/ra66dc3ce64ec4c63af091d4ced99b95c'],''),null,outputs('Get_response_details')?['body/ra66dc3ce64ec4c63af091d4ced99b95c'])

vLilyWmsft_1-1630380537243.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-LilyW-msft  - thank you so much for your quick response! When entering that expression, I receive an error per below:

error.png

Am I missing something?

 

Take care,

Abbey

Hi @amiles1 

From your screenshot, there is a missing ‘(’ between if and equal, Please add '(' and try again.

vLilyWmsft_0-1630458074569.png

Best Regards

 

thank you again for the quick reply. I have updated the expression and I still receive this error:

 

error2.png

amiles1_0-1630528095070.png

 

Any additional troubleshooting advice?

 

Thanks,

Abbey

 

Hi @amiles1 

I don't see any problem in your formula.

Please add a Compose action and select End Date in it before Create Item action.

vLilyWmsft_0-1630567072783.png

Then copy the Expression and try again:

if(equals(outputs('Compose'),''),null,outputs('Compose'))

vLilyWmsft_2-1630567279237.png

Best Regards.

Thanks Thanks Thanks !!! I had the same problem. This resolved it like a charm. 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,685)