Skip to main content

Hi community,

I am trying to create a workflow to weekly/daily check a calendar for new items, and then generating Folders and tasks to specific List/Libraries.

To make it a bit easier:

I have a Site with 20 different Clusters each having their individual owner and library (Each of the owners is able to see only his page). Additional to the clusters, I have a Calendar where I am filling elements that are the trigger for each Cluster to do something. E.g. When I add into the calender "Project123" with an enddate of 01.10.2018. I want the system, 7 months before enddate, to create a folder called "project123" to the library of each cluster, and to generate a task "Plan Project123" for each cluster owner.  

To achieve this I have currently 2 workflows, but am facing trouble with the second one.

1. Worfklow at the Sitelevel:

To calculate date 7 months from Today, and save it into a variable. Check the calendar for Items that are equal or smaller als the saved variable. And for each element found, changing a metadata "SoPin7Monate" into "yes"

2. Workflow at Cluster/Librarylevel (for each cluster):To set the responsible persons, and then check the Calendar for all elements that have "SoPin7Monate" equal to "Yes", and new metadata "Planned" equal to "No". For each of these elements I want to create a Folder called "Project123", and to change afterwards "Planned" to Yes. Currently I am stuck at this workflow, as it is running correctly but only generating the first Folder on the list.

Ànyideas what I am doing wrong, or if there isa better way?

Best wishes,

Paavo

it is running correctly but only generating the first Folder on the list

this sounds to me like you are storing query list result set into a scalar variable (like single line text, number,...).

once you might get more then one item returned, you have to store result set into a collection variable


Thank you for the reply! And first of all, sorry for the delayed reply. The Christmas Holidays took all the energy out of me, and pushed me into the bed for few weeks! 

I am saving the IDs from the list in to a collection, and for the IDs the relevant information (i.e. Date and Name in to normal variables). I tried changing these also to a collection variable, but this leads again into one folder created with name consisting of all the names in the collection. 

Any other ideas? Is there some information that I can provide, that could help in solving my issue? :-)

Edit. I just checked again. I think the mistake has to be in the direction you mentioned! The workflow is updating each Element on the calendar list, and it is also creating a folder for each new element. Nevertheless, only one folder is created. I think the mistake could be coming from the naming of the folders. I am storing the name of the elements into variable "vTitleAnlauf" that is a scalar variable (see pictures). And creating the folder by using this variable as a part of the folder name. I am thinking that the workflow keeps taking only the first Title detected in the worfklow? 

Bests,

Paavo


I was able to solve the problem creating the folders using this excellent guide!

https://community.nintex.com/community/build-your-own/blog/2016/06/06/queries-and-collections-and-loops-oh-my

Thank you Marian for pushing me into the right direction! I simply first stored all the information into collections, and used the collection operation to get the relevant information per each ID! I created the second workflow as a site workflow, where it add each cluster the new folder. 

Now I am stuck at generating the task for each new folder. Is there a way to trigger a worfklow for each new folder generated in a specific Library. I would simply need a scheduled workflow to create a new Flexi Task "Plan Project x" for each new folder on the library. So far I have not found out how I can trigger a workflow from a folder, instead of a element. Would it be possible to add some metadata into the folder, and let the workflow daily scan the folders where the metadata is "a", create the task, and parallely change the metadata to "b", and finally after the task is completed change the folder metadata to "c". Does this make sense, or am I completely on the wrong track? 

Bests,

Paavo


great you proceeded on.

folder is just the same library item as document in this regard, it's just different content type. so you can run a workflow on it.

you can configure workflow to run automatically when item is created and it will be started once (eg) the folder is created.

or you should be able to start it manually from right click menu.


Thank you again :-) 

I am struggling a bit with creating the workflow on the library level. My problem is that I would like to start a workflow only when the folder is created, that is, the user should be able to add new files and folders within the created folder, without triggering the workflow again. I was planning to use such metadata to identify the folders created by the previous WF. Nevertheless, there seems to be no option to change a folder attribute when usinh "create an element" with content type "Folder." Any tips or workarounds? 

I get it working when I create a new documennt where column "status" is "ongoing" while I have the standard set to "-". By doing this I can use "run if" to avoid starting the worfklow for each new element. Nevertheless, it is not really pragmatic to have such dummy files! 

Best wishes,

Paavo


unfortunately, on a library you can not start workflow conditionally, so you have to let it start on each new item.

within workflow yo have then decide whether there are conditions met to take some action.

in your case I think you do not need any additional metadata. you can decide by content type.

if the workflow should run just for folders you can use Filter action and set its condition to check whether content type == Folder

212039_pastedImage_1.png


Perfect!

One more "complication": How about when the user creates a sub-folder, which naturally triggers the workflow as the content type is a "Folder". Would there be a possibility to use the "Filter" function to recognize this also? 


it should be manageable.

folder URL should look like: <LibraryURL>/Folder1/Folder2/Folder3...

so if you cut off Library URL, you can then count somehow how many folder levels are left in there. then you can extend filter condition by the check that there is no more then 1 level.


unfortunately, I am not able to realize this. I tried by setting the filter to match a certain url-path:{Common:WebUrl}/{Common:ListName}/01_Ubergabe_Baureihe/{ItemProperty:FileLeafRef}

even when this is giving me the correct path to the folder, it does not accept it at the filter. The idea of using the level I cannot figure out. It woul always be the Folder lvl 2. means <LibraryURL>/<01_Ubergabe_Baureihe>/<Folder_generated by_WF>/

Thanks again for support!


I rather meant something like this instead of exact match of folder path.

first I would remove site URL to get just relative folder path. this can be done with a regular expression action.

note the extra slash in regex pattern which makes later processing easier

212073_pastedImage_1.png

with another regular expression I would split folder path to single folder names and stored them into a collection variable.

number of collection elements gives me info how deep in folder structure/levels my current folder is

212074_pastedImage_2.png

so I count number of collection elements

212075_pastedImage_3.png

and use the figure in filter condition.

1st level is library itself.

2nd level is top level folder within the library - so I need to check I'm not deeper then on 2nd level

212076_pastedImage_4.png

  workflow on folder


Edit. It is working! Thank you so much for the support! 

I have one final question that is not really matching the topic, but I would not like to start a new thread. Is it also possible to use the regular expression to break a date (e.g. 01.01.2018) I pulled out with a query into a format like 0119 that I could use in the naming of the Folder? 

Thanks! 

Thank you for the clarification! I understand the logic, but unfortunately I am not able to get it working. I followed your example, 1-to-1 and got still results saying that the element is not within the filter requirements. Just to control the levels, I also tried changing the nbrLevels to 1 & 3 respectively, but still don't get forward. 


likely yes.

if I only knew a magic math behind conversion from 01.01.2018 to 0119...


Reply