You are viewing limited content. For full access, please sign in.

Question

Question

How to delete empty folders using Workflow

asked on May 20, 2014

 So I have a Workflow that is routing documents through a review process.  What I'd like to do is when the last document within that folder is moved to the next folder, I'd like the empty folder to be deleted.  What is the easiest way to do this?  I tried setting up a delete entry activity right after the route to folder entry and use the "Entry to Delete" Other "Routing Folder", however, it does not seem to work.  Am I missing something here?

0 0

Answer

SELECTED ANSWER
replied on May 21, 2014

The activities are performed in a top-down order. If Workflow finds a wait condition, it will wait for it to be satisfied first before performing the next activity. So currently, your workflow is waiting for JohnR. Update Instructions and Delete Entry will only be executed after that condition is satisfied.

 

If you want to delete the empty folder and update instructions before the document is assigned to JohnR, then move the doc to JohnR's folder first, then update the instructions and delete the empty subfolder. Then add a wait condition for the action JohnR needs to do.

1 0

Replies

replied on May 20, 2014

It seems to work for me. To be clear, your Delete Entry activity comes after the one that moves the document out of the folder you're trying to delete.

 

0 0
replied on May 21, 2014 Show version history

Yes, but I get a message that "The Folder is Not Empty"...however, there is nothing in the folder.  What happens is under the Afyia's Folder, a subfolder gets created based upon a Batch #.  When that folder becomes empty, I want it to be deleted...so I think the issue is that the Delete Entry is trying to delete the "Afyia's Folder" and can't because there is an empty subfolder.  I don't want it to delete Afyia's Folder, but rather, the Empty Subfolder(s).

0 0
replied on May 21, 2014

From your diagram, the subfolder does not become empty until the WF runs one of the branches in "Routing Decision based upon Afyia's Review" and runs one of the routing activities that moves the document out of Afyia's folder.

0 0
replied on May 21, 2014

So do I need to change the location of my Delete Entry or will it not work in my case?  If not, is there another way to accomplish it?

0 0
replied on May 21, 2014

Right, the Delete Entry activity needs to be in a place where the folder could possibly be empty. In its current location, the document will always still be there, so there is no way for the deletion to succeed at that point.
 

1 0
replied on May 21, 2014

So I spoke to soon...so I'm able to get it to work in 2 of my 3 routing decisions, but when it goes down the "Needs Changes" branch...I can't get my the folder to delete nor can I get the Business Process Instructions to update??

0 0
replied on May 21, 2014

What activity is currently running when you check the instructions?

0 0
replied on May 21, 2014

So I changed my workflow and just made that Routing Decision a Business Process as I have the other 2 Routing Decisions as well, so that I don't have to "Check the Instructions"...but even then, it still doesn't delete...below are the activites running when I get to the point where the document has gone through the Routing Deicsion of "Needs Changes".

 

0 0
SELECTED ANSWER
replied on May 21, 2014

The activities are performed in a top-down order. If Workflow finds a wait condition, it will wait for it to be satisfied first before performing the next activity. So currently, your workflow is waiting for JohnR. Update Instructions and Delete Entry will only be executed after that condition is satisfied.

 

If you want to delete the empty folder and update instructions before the document is assigned to JohnR, then move the doc to JohnR's folder first, then update the instructions and delete the empty subfolder. Then add a wait condition for the action JohnR needs to do.

1 0
replied on May 22, 2014

Miruna,

I completely understand what you're saying, but where I'm a little confused is that my Delete Entry is to delete the folder that was in Afyia's Folder, not John's.  So I figured once it get's to John's Folder, it should delete the empty folder in Afyia's folder.  So my Delete Entry is placed after it is moved into John's Folder because that should ensure that the document is no longer in Afyia's folder and therefore can be deleted.  So the Delete Entry 3 is NOT working, but the Delete Entry 2 is working and they're setup the same, the only difference is when it's routed to the Customer Care group there is no wait activity whereas with John R. there is a wait activity...but why would that matter since at that point, it's been moved from Afyia's Folder (which is where I want it deleted from?

You are not allowed to follow up in this post.

Sign in to reply to this post.