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

Question

Question

Create a Workflow to Create Group of Folders

asked on April 29, 2024

Hello,

I am trying to create a Workflow that will verify if a folder exist in another folder.  If it doesn't exist create it and all of the other folders that are missing.  If it does exist do nothing unless the other folders are missing.

 

HR Folder\Staff\Employee Last 4 of SSN - First Name Last Name\(Group of Folders)

 

Group of Folders

Payroll

Credential

Transcripts

Confidential>Medical

Confidential>Evaluations

Confidential>Disciplinary

Insurance

I have been able to do this when creating an entry but haven't tried it when a folder is there.  

Our issue is that we have a bunch of folders in the HR folder right now and we don't want to have it overwrite them if they exist and the other idea is that when an HR staff member creates a folder inside the Folder for a new Employee, we want it to create the folder too.

Thank you!

0 0

Answer

SELECTED ANSWER
replied on April 30, 2024

To me, it would make more sense to have a workflow that runs on entry creation where entry type is folder, path is `HR Folder\Staff\`, and folder name matches `^\d{4}.+$`, then have that workflow create the subfolders. That way, any time the parent folder is created, the subfolders are automatically created. If you still insist on checking if they exist first, just make a parallel activity where each branch will search for one of those folders where the entry type is folder, parent path is `HR Folder\Staff\%(Entry ID)`, and the entry name is `%(VariableForEntryName)`. If the result count is 0, create it.

Even better, have the parent and child folder creation automated by an HR onboarding Forms process instead of having anyone manually creating them, and do away with this messy folder creation process altogether.

1 0
replied on May 1, 2024

This sounds like a good idea.  

On the HR onboarding forms, what if we are going through old folders that haven't been scanned yet?  

I will give the top part a try, and try to figure out how to get the other parts working.

Thanks!

0 0
replied on May 1, 2024

Sorry, but I am new to the code but what does the ^\d{4}.+$ do and mean?

I am just trying to figure out if I need to change any of that.

Thanks again!

0 0
replied on May 1, 2024

Why is it important that the folders exist? If a workflow is moving the files to the folders, the folders will automatically be created. If you really need to ensure the folders exist, you'd need to create a workflow that would run only once to do a search for all folders where entry type is folder, path is `HR Folder\Staff\`, and folder name matches `^\d{4}.+$`. Sound familiar? Then use the "for each entry" activity to do the same folder creation I described above for each folder.

 

"^\d{4}.+$" is a regex statement. I can break it down for you. "^" means the beginning of the string. "\d{4}" means that the first 4 characters should be digits. ".+" means that the following characters can be anything and of any length. "$" means the end of the string. It would just validate at a very simple level that the folder is named starting with the employee's SSN last 4.

1 0
replied on May 1, 2024

I used your idea to create a form and workflow.  

That worked great!  It is not checking if folders exist but I have told staff not to use it for anyone that already has a folder created.  

Awesome!  Thank you!

0 0
replied on May 1, 2024

You shouldn't need extra handling, Create Entry has an option to check if an entry by the same name already exists.

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.