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

Question

Question

Delete Folder of a Moved Entry

asked on June 7, 2017

I'm attempting to re-route document entries that were originally routed based on one metadata field and now must reference a different metadata field. The issue I'm facing is how can I delete out the folder the document was originally in after I've re-routed the document? Each document that is rerouted is in a parent folder that is named the exact same. That parent folder is just sitting in a different parent from the original.

The example is below - I re-routed my document/parent folder to the 2015 folder, but the old folder empty and is still hanging out under 2010.

 

 

0 0

Answer

SELECTED ANSWER
replied on June 8, 2017

Find Entries can find multiple documents, but you're only routing one in the activities in your workflow. To iterate through all the entries, you'll need a For Each Entry activity.

That said, since it sounds like this is a one-time repository reorganization, I think it's probably best that you break up the 2 actions (moving docs and deleting empty folders). Once you're done moving the documents you can clean up all empty folders left behind. An example of how you could do that is discussed in this other thread.

1 0

Replies

replied on June 7, 2017 Show version history

Katie,

If you're relocating the document with Workflow, then you can use a Delete Entry activity in the same workflow, however, you might need an extra activity in there so you can target the correct folder.

In the example below, I use a "Find Entry" activity to locate the starting entry, I move it, then I use a Delete Entry activity that looks at the "ParentFolder" returned from the Find Entry.

This is important because if you try to use the ParentFolder from the Move activity, I believe it will target the new folder, not the original folder.

I would also recommend setting it to "Only delete empty folders" so you don't risk deleting any documents that might still exist in those folders.

 

If you are moving these files manually, you could instead handle it with a Rule that detects when an entry is moved, and acts the entry's original folder if it is empty.

0 0
replied on June 8, 2017

So I tried that out, but I think I'm running into an issue in not being able to limit the Find Entry to just documents. The metadata referenced for the naming convention of both the document and its parent folder is located on the document entry and not on the parent folder. So I end up with parent folders for the moved entry that are blank, or minimal, while the document is still named correctly.

I have this workflow setup (below), which leaves me with empty folders from the original document, but I think I will end up doing a search on empty folders and deleting. Does that make sense to do?

 

0 0
SELECTED ANSWER
replied on June 8, 2017

Find Entries can find multiple documents, but you're only routing one in the activities in your workflow. To iterate through all the entries, you'll need a For Each Entry activity.

That said, since it sounds like this is a one-time repository reorganization, I think it's probably best that you break up the 2 actions (moving docs and deleting empty folders). Once you're done moving the documents you can clean up all empty folders left behind. An example of how you could do that is discussed in this other thread.

1 0
replied on June 8, 2017 Show version history

As Miruna said, the Find Entries is going to behave very different from Find Entry because the former is a Collection and the latter is a single object. To limit Find Entries to just documents, you need to set the filter to documents only.

Again, like Miruna said, either way you will to need add a "For Each Entry" activity to iterate through each item in the "Find Entries" results.

Personally, I typically like using the following approach for one-time reorganization processes because I don't have to double back to clean up the folders afterward.

  • Workflow 1
    1. Use the current folder as the Starting Entry
    2. Find Entries (find Documents in the Starting Entry)
    3. For Each Entry (iterate through each document in Find Entries)
      • Invoke Workflow - Workflow 2 (select "Wait for the invoked workflow to finish running before continuing")
        • Workflow 2 (published first)
          1. Retrieve Field Values
          2. Routing Decision (your current activities)
    4. Conditional Sequence (IF Starting Entry Entry Count = 0)
      • Delete Entry (Set to only delete empty folders)
0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.