Pause a Loop until every Friday


Badge +6

Hi All,

I try to build a WF for SP 2010  where a data request is going out every Friday to users to fill in a time sheet on the "active" tasks they were working on in the week.

In nutshell the WF should run for tasks where Area field equals "PMO" and status field not equals "completed" or "cancelled" and its Friday (midday).

I only miss the last part to pause until its "Friday" than wait until the next "Friday".

I thought its easy to configure, but now I am stuck with building my WF because of this, hope somebody can help...


12 replies

Badge +11

Hi Robert,

i presume you are using a site workflow. These site workflows can be scheduled:

Capture.JPG

There you can configure the start date of your workflow (choose the next friday 12pm ) and configure it to repeat every 7 days. You could also use a "pause for..." action in a loop and configure it to pause your workflow for 7 days but this also means you have only one workflow instance running forever, which makes it more difficult to maintain it or report on it.

Let us know if this solves your issue.

Regards

Philipp

Badge +6

Hi Philipp,

My workflow is for a specific list only not the site, so I cant see it in the Schedule Site WF menu.

Pausing for 7 day is also not good, because who knows when the item was created, if it was created on Monday than the WF will run next Monday and not on Friday.

What I need is to give a value to the Pause for... "until today is Friday".

Badge +11

Is there any (good) reason for you not using a site workflow? This would be more appropriate for your requirement and you will only have one workflow running once per week. I don't see any disadvantages in using a site workflow here.

If you insist on using a list workflow you will first of all need some logic to find out which day is today (don't know if anything else but a web service is possible here) and then wait until the next friday (even more logic to implement: if today is monday wait 4 days, if today is tuesday wait 3 days, ...). This is possible, but imho completely unnecessary because the site workflow schedules take this pain away from you.

Badge +6

If the Site WF will give me the same option to target list items than I will try it out now, thank you!

Badge +11

Sure it will! The only thing you lose is the possibility to target your "current item" because you just dont have that in a site workflow. But you can always query all lists to get the items you want and treat the item as current item. Which means it maybe a tiny bit more complex to design this workflow, but you can do the same as within a list workflow. Plus you have the scheduling possibilities.

If you need further assistance while creating this site workflow, just let us know. The comm will be glad to help wink.png

Cheers

Philipp

Badge +6

Ok so I could make the same WF that was working at list level with a Query list action.

For test I have add myself only to Request data "Collect data from" but I received only 1 task and after entering the value the WF run to error. The same WF was running perfectly as list wf.

How can I make sure that everybody will get all the request task belonging to them as individual task?

(The Set variable is only to transform the display name as Name and not code in the task mail.)

178485_pastedImage_0.png

Badge +11

I presume you configure your query list action to get the assignee of each task where the status is not completed or cancelled and area field equals pmo. As a result you will get a collection of all the assignees. You need to store this collection in a variable of type collection and use a "for each" action to perform some actions for every item in your collection.

For example if you get back a collection of multiple users (assignees) you need to loop through the collection and put your request data in the for each loop of the collection variable.

Of course you only get one task if you only enter yourself as assignee, this is regular behaviour. Why should nintex create more tasks? (This is why you need the loop)

And for the wf error I would ask you to provide the error message and/or the configuration of your actions.

Regards

Philipp

Badge +6

Thank you Philipp!

I didn't used collection variable, so this explains the error, now I use it for the users.

I also Queried the task "title" so I can use them later (Single line of text variable).

I will try the for each loop action as you mentioned.

I am new with building WF's and the only person in my company trying to figure it out, so appreciate your help happy.png

Badge +11

You're most welcome, this is what the community is here for wink.png

Badge +6

Well I tried a lot of things but its just not working the way it was with list WF.

For start the List Query is not filtering the list, its giving me all list items when I run it.

What is wrong with the setup? Just note I had to enter manually "PMO", "Completed", "Cancelled". Had no option to select from a drop down or else.

178489_pastedImage_0.png

Secondly if I put the "Request Data" inside the "For each loop" it is waiting me to respond to the task and only than sending me the next one. Shouldn't it work the way that I receive all the tasks belonging to me at once? Or I miss an action to separate the tasks by users, so everybody receive only the tasks belonging to them? It was no difference if I put the create item inside or outside the loop as I noticed, but I guess it should be inside right?

178490_pastedImage_1.png

     178491_pastedImage_2.png

    178492_pastedImage_3.png

Badge +11

You are right, inside the loop the tasks are assigned serially. You would need to use parallel paths instead of a loop if you need your tasks assigned all at once. Another workaround is to create a SharePoint group. Inside your workflow you store all users of your collection inside the group and assign the task to the whole group. You have the option to create individual tasks for all group members. When the workflow is about to end, you delete everybody from the group so you have it cleaned up for the next process running.

For adding a user to a group you can use the call web service action and use the usergroup webservice (AddUserToGroup method) SharePoint offers: https://msdn.microsoft.com/de-de/library/office/websvcusergroup.aspx and you can do this inside your loop.

Your filter configuration doesn't look wrong. However there is a help post about logical operators you can have a look at: http://help.nintex.com/en-US/O365/Default.htm#O365WorkFlow/Getting%20to%20know%20NWO/Boolean%20logic%20operators.htm?Hig…

Can you make sure that you have all different states available as well as items where the area is different than "PMO"?

Badge +6

Hi Philipp,

I was thinking on this and here is how I solved it finally.

I was using both Site and List workflow:

1. For Site workflow I scheduled to run every Friday and the only thing it does is to set a Friday field in the list to "Yes".

2. For the list workflow I added "Wait for item update" to wait for the Friday field to contain "Yes". Than the wf runs and the end it sets back the Friday to "No" and the loop is waiting again until the Friday is set to "Yes" again by the Site wf next Friday.

I guess pros can solve it other way, but I think this is a very easy solution to anybody who would like to use the best of both kind of WF's. happy.png

Robert

Reply