cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AZ32
Regular Visitor

Form to List with dates, list won't populate if one date is left blank

Hi there,

I've created a flow (see attached screenshot) that takes data (all dates) from a form, adds 2 years to it and then puts it in a Sharepoint list. Works fine as long as all 3 dates have been filled in, but sometimes not all of them will be. I've tried several different expressions that I've gotten off the forums such as:

if(equals(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],''),null,addToTime(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],2,'Year', 'MM/dd/yyyy')   

and

if(empty(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],''),null,addToTime(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],2,'Year', 'MM/dd/yyyy') 

(which Microsoft says are invalid expressions)

 

and then I tried several Compose actions which also did not work. 

 

The expression I have been using for the adding 2 years (with different reference numbers for each question) is: addToTime(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],2,'Year', 'MM/dd/yyyy') and as I said, that works fine if all the dates are filled in.

 

Anyone have any insight for me? Thanks so much!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-chengfen-msft
Microsoft
Microsoft

Hi @AZ32 ,

The cause of this problem is:
1.empty formula error
2. The brackets of the if condition are not finished

vchengfenmsft_0-1669953480876.png

 

Please try:

if(empty(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013']),null,addToTime(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],2,'Year', 'MM/dd/yyyy'))

 

Best Regards

Cheng Feng

View solution in original post

2 REPLIES 2
v-chengfen-msft
Microsoft
Microsoft

Hi @AZ32 ,

The cause of this problem is:
1.empty formula error
2. The brackets of the if condition are not finished

vchengfenmsft_0-1669953480876.png

 

Please try:

if(empty(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013']),null,addToTime(outputs('Get_response_details')?['body/r69015fa44b3d416f898743307b0b0013'],2,'Year', 'MM/dd/yyyy'))

 

Best Regards

Cheng Feng

Thanks so much, it worked!! And thank you so much for the information, it helps so much when trying to figure out what's wrong with the code. 🤗🤗

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
Users online (1,542)