cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ubikwitous
Level: Powered On

Flow to check field on SharePoint Item, then move the Item to another list

Hello out there!

I'm trying to create a flow to 
1. Run Weekly.

2. Check all the items in the list for Status.Value = Completed and if they are older than 180 days. (expression = @less(formatDateTime(triggerBody()?['Completed_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(addDays(utcnow(), -180), 'yyyy-MM-dd'))

3. Get the ID of that item and copy all the fields to another SharePoint list item

4. Delete the original item in the original list.

 

This has the effect of moving Completed tasks I am tracking to an archive list.

 

I have tried this in the below Flow, but I'm getting a failure at Apply to each and I'm not sure why. It looks like something in the expression, but I'm using it in another Flow with no issues. Here's the error. Thanks!

 

ActionFailed. An action failed. No dependent actions succeeded.

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2505': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

flowfail.png

1 ACCEPTED SOLUTION

Accepted Solutions
Flow Staff Sunay
Flow Staff

Re: Flow to check field on SharePoint Item, then move the Item to another list

Do you have items in your SharePoint list where the Completed Date is not set?

This error message -

Unable to process template language expressions for action 'Condition' at line '1' and column '2505': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'

states that - The first parameter passed to the "formatDateTime" function was null.

I'd recommend filtering out items from the SharePoint list that have Completed Date set to null using OData fitlers.

 

Additionally, if you are not comfortable with Date Time conversions using expressions - you can use the GUI based date time operations. Convert Date time also allows you to pick custom formatting.

 

image.png

6 REPLIES 6
Super User
Super User

Re: Flow to check field on SharePoint Item, then move the Item to another list

Hi @ubikwitous , thank you for your post.

Try this as your condition:

less(formatDateTime(triggerBody()?['Completed_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(addDays(utcnow(), -180, 'yyyy-MM-dd'), 'yyyy-MM-dd'))

If you have found my post helpful, please mark thumbs up.

If this post has solved your problem, please click "Accept as Solution".

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


ubikwitous
Level: Powered On

Re: Flow to check field on SharePoint Item, then move the Item to another list

Hi AlanPS1!

I'm still getting the same error unfortunately. I think I must be doing something wrong in the flow of the Flow. I don't see a way to enter the formula in, so I actually have:

 

formatDateTime(triggerBody()?['Completed_x0020_Date'], 'yyyy-MM-dd' 

is less than

formatDateTime(addDays(utcnow(), -180, 'yyyy-MM-dd'), 'yyyy-MM-dd')

 

InvalidTemplate. Unable to process template language expressions for action 'Condition_2' at line '1' and column '2506': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

Super User
Super User

Re: Flow to check field on SharePoint Item, then move the Item to another list

Put that expression on the left of your condition and make equal to true(expression)

Check here for info on this as I tested it my end. Pretty sure I didn’t miss anything

https://www.alanps1.io/power-platform/flow/flow-so-where-has-edit-in-advanced-mode-gone-on-condition...

Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


ubikwitous
Level: Powered On

Re: Flow to check field on SharePoint Item, then move the Item to another list

Dang! I had a couple of 'ohhhhhhhh' moments, but it still isn't working. Same error. You can see I pasted the formula on the left, is equal to, then true as an expression.

Where Status.Value does equal Completed, it is returning false and then Condition 2 states:

ActionBranchingConditionNotSatisfied. The execution of template action 'Condition_2' skipped: the branching condition for this action is not satisfied.
 
Where Status.Value does not equal Completed, it is the same error as before. I've even tried moving Condition 2 up to Condition 1 with an And, but it still returns Null. 
 
This screenshot is before I moved it up.

 

flowfail2.png

Flow Staff Sunay
Flow Staff

Re: Flow to check field on SharePoint Item, then move the Item to another list

Do you have items in your SharePoint list where the Completed Date is not set?

This error message -

Unable to process template language expressions for action 'Condition' at line '1' and column '2505': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'

states that - The first parameter passed to the "formatDateTime" function was null.

I'd recommend filtering out items from the SharePoint list that have Completed Date set to null using OData fitlers.

 

Additionally, if you are not comfortable with Date Time conversions using expressions - you can use the GUI based date time operations. Convert Date time also allows you to pick custom formatting.

 

image.png

ubikwitous
Level: Powered On

Re: Flow to check field on SharePoint Item, then move the Item to another list

You guys both got me there - thanks for the suggestions!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 176 members 3,808 guests
Please welcome our newest community members: