cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kev-D
Regular Visitor

Flow deleting documents runs successfully but fails to delete documents!

Hi All,

 

I have created a flow that runs successfully, however the condition is never met and no documents are ever deleted, can someone point me to where I am going wrong please?

The condition is

utcNow('yyyymmdd') is greater than formatDateTime(addDays(item)?['Created'],2),'yyyymmdd')

 

The documents have been created for more than 5 days so in theory should be deleted?

Any help appreciated.

KevD 

 

14 REPLIES 14
Mira_Ghaly
Dual Super User II
Dual Super User II

@Kev-D 

Please use formatdatetime(utcnow(), 'yyyy-MM-dd') and use the same format on the other variable 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

Thank you for the support, really appreciated.  The workflow failed this time with the following error message:

 ActionFailed  An action failed.  No dependant actions succeeded

 

Condition set to:

formatDateTime(utcNow(),'yyyy-MM-dd') is greater than formatDateTime(addDays(item()?['Created'],2),'yyyy-MM-dd')
 
KD
Mira_Ghaly
Dual Super User II
Dual Super User II

@Kev-D

TThis means that the condition wasn't satisfied, can u add each expression to a compose data operation to be able to see the values of each on the workflow run

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

Apologies, I am new to Flows in this format, I added a compose data operation the first expression returned 2020-08-11

The second expression returned 2020-08-08  as the documents were created on the 06/08/2020 this would seem right?

In the Delete file action it warns "NotFound"

 

KD

 

Mira_Ghaly
Dual Super User II
Dual Super User II

@Kev-D

YYes for the first compose please add formatdatetime(utcnow(), 'yyyy-MM-dd ')

And another compose data operation and in the expression add

 

formatDateTime(addDays(item)?['Created'],2),'yyyy-MM-dd')

 

Run the flow, then open the flow run and examine the outputs of the 2 compose Data operations., may be you need to convert the second date to Utc

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

Hi,   I just edited my last post once I realised what you had asked, I got the following returns from the expressions:

 

Expression 1 returned 2020-08-11

Expression 2 returned 2020-08-08

 

Documents were created on the 06/08/2020 so the second expression is correctly adding 2 days to the created date so all should be well?

Thank you for the help

Mira_Ghaly
Dual Super User II
Dual Super User II

@Kev-D

Yes the expressions looks good, can u use the outputs of the compose data operation  in the condition expression instead and if you can share a screenshot this will be great. 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

You lost me with that statement I'm afraid, what are you asking me to insert, just the dates instead of the format?

DeleteFlow.png

@Kev-D I can see in your right hand condition u are adding 7 days instead of 2

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Kev-D

Also make sure the format string is yyyy-MM-dd

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

Apologies, that was an old screenshot. DeleteFlow2.png

Mira_Ghaly
Dual Super User II
Dual Super User II

@Kev-D

Can u try to use the convert time zone action to convert from UTC to your time zone and the use the output in the left side of your condition expression 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

@Mira_Ghaly 

Hi, I am lost!  Can you give me an example please, I have searched Google and cannot work out what it is you are asking me to do?

 

KD

Kev-D
Regular Visitor

Latest failDeleteFlow3.png

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (74,814)