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

Subtract days to sharepoint dates column

Hello,

 

I'm creating a flow that checks if some of the dates on a sharepoint list subtracted by 15 days matches with today and then sent an e-mail.

 

I've got it all figured out, just having an issue with the subtraction to the date.

 

This is the sharepoint column with the dates format as date only

1.PNG

 

I've tried to do the subtraction with this expression - 

addDays(triggerBody()?['DataCaducidade'],-15), but it's getting me this error:
 

3.PNG

 

I know the flow it's correct cause I've tried without the subtraction and it works.

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Subtract days to sharepoint dates column

 

Hi @Miguel_MESP ,

 

Could you provide the full screenshot of the Flow configuration so that we could do a further analysis?

If you are getting the date from Get items action, you could not get the date by using triggerBody()?['DataCaducidade'].

 

If you want to check all items in the list, you could refer to the following configuration.

  • The date format you are using is not an expected format of Date and Time function, so you need to convert the format first.
  • Then you should check if the date field is empty.

Image reference:

66.PNG67.PNG

Expression reference:

concat(split(outputs('Compose'),'/')[1],'/',split(outputs('Compose'),'/')[0],'/',split(outputs('Compose'),'/')[2])

Please take a try and feel free to let us know if you have any questions.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Dual Super User
Dual Super User

Re: Subtract days to sharepoint dates column

Hi! So, the Sharepoint list item that triggered the flow execution has the Date Column empty, right?
This explains the null error
Now, under such circumstances, what you wanna your flow behave? Just stop processing?
Thanx!
Pd. Similar issue discussed here, but in the context of a 'Get items'. So assuming youbwanna stop processing, or apply a different logic, you can add a Condition action block, and evaluate if your column is empty by assigning to the left term of your confition rule the following expression:
empty(triggerBody()?['yourInternalColumnName']
Next follow the instructions from the link I just shared
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Regular Visitor

Re: Subtract days to sharepoint dates column

Hi @efialttes @efialttes 

 

I didn't explained me well. I want to create a cycle that verifies the already existing dates on the column and subtract 15 days to that date and see if matches Today date. The flow will execute everyday and only if it matches will send an automatic e-mail to remind a person to update the file.

 

2.png

 

So these dates on the table should assume the values : 23/04/2020 | 24/04/2020 | 25/04/2020 and compare with today,

1.PNG

 

I think the expression that I'm using isn't the correct to this purpose.

Highlighted
Dual Super User
Dual Super User

Re: Subtract days to sharepoint dates column

Hi!

I canot see any error in your sintax. But... there is a quite easy way to do the troubleshooting on your expressions... before the Condition action block, add two dummy Compose action blocks, assign the following expressions to each of them:

addDays(triggerBody()?['DataCaducidade'],-15)

...and...

formatDateTime(utcNow(),'yyyy-MM-dd')

Then reexecute your flow, inspects their outputs.

 

As I mentioned before the null error comes from a column that is empty... but this error can also happen if the Sharepoint Internal Column name does not match with the Sharepoint Display Column Name. If so, you can identify the internal name by adding a third Compose action block, assign the column from th dynamic content menu, then hover your mouse over it.

 

Hope this makes sense

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Regular Visitor

Re: Subtract days to sharepoint dates column

hey @efialttes 

 

So at compose 2 I've inserted the sharepoint column and it gets the correct dates. At compose 3 I put the expression adddays and is getting me the error. So the error comes from the expression, I don't know why. the triggerbody()?['DataCaducidade?] should return the values of that column right?

 

1.PNG

Highlighted
Community Support
Community Support

Re: Subtract days to sharepoint dates column

 

Hi @Miguel_MESP ,

 

Could you provide the full screenshot of the Flow configuration so that we could do a further analysis?

If you are getting the date from Get items action, you could not get the date by using triggerBody()?['DataCaducidade'].

 

If you want to check all items in the list, you could refer to the following configuration.

  • The date format you are using is not an expected format of Date and Time function, so you need to convert the format first.
  • Then you should check if the date field is empty.

Image reference:

66.PNG67.PNG

Expression reference:

concat(split(outputs('Compose'),'/')[1],'/',split(outputs('Compose'),'/')[0],'/',split(outputs('Compose'),'/')[2])

Please take a try and feel free to let us know if you have any questions.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (5,812)