How our process works: We have a meeting and review various projects. Each stakeholder needs to approve each project. I am attempting to move this manual process into a work flow.
Here is my idea: I start with querying the list and pulling in the projects that will need approved that day into a collection. There can be 1-20 projects at any given point needing approval. I initiate a for each, in which I declare them as records to avoid further editing prior to the approval process. I then assign a flexi task....there lies the problem. I don't know if this will work.
Will I be able to know which project is associated with each outcome variable?
Should I have a spin off that starts a new workflow; if so; how can I bring the data all back together?
Will each project send off its own flexi-task?
Desired end result: Send an e-mail notification with a list of all the projects for that day, their approval (or lack thereof) and the comments for each. I know how to build the table and pull everything together...
I am not sure if the for each-flexi task will work the way I need it to. I am open to suggestions.
Why not consider an Item based workflow for this type of thing?
If you try to loop over a collection of items, and assign tasks to them (which I’m not even sure if that’s possible on a site-workflow level), you’re going to have a bad time.
Specifically, a loop would pause for every flexi-task it encountered until it was completed. Being that you’d probably want all of these various Project Meetings Approval tasks to run in parallel / asynchronously (because multiple people can who all went to different meetings should ideally be able to approve their respective tasks), keeping them in a loop would mean that the first Project Meeting targeted would have to be Approved and completed before the next Flexi-Task / Loop Iteration could start.
However, if you were to create a SharePoint List Item that maybe represented the Meeting. You could populate it with relevant data such as Start Time / End Time / Attendees, and use that information to either Schedule Item Workflows to run at certain times, or even just have a workflow that runs on Item create, but waits until [Today’s Date] > [End Time] before assigning a Flexi-Task to all of the Attendees.
Now, depending on how you’d like to handle things such as Flexi-Task Rejection, there could be a case for using a loop to clear out names from a collection of people who have / have not approved, so that you can cycle the task again until all questions have been satisfied, but that is outside the scope of this question.
"However, if you were to create a SharePoint List Item that maybe represented the Meeting. You could populate it with relevant data such as Start Time / End Time / Attendees, and use that information to either Schedule Item Workflows to run at certain times, or even just have a workflow that runs on Item create, but waits until [Today’s Date] > [End Time] before assigning a Flexi-Task to all of the Attendees."
I like this idea. The items are already in a list with this information (excluding attendees, which can be added in the flexi-task)
To clarify: Instead of querying the library and pulling them into a collection, have it run on each item individually, so same process as I stated above without the for each.
With this; is there a way I could bring all the results together for the end result notification?
Well. I would first ask, "What are you looking to accomplish with this Flexi-Task?"
Does everyone need to Approve / Accept?
Do only a Majority?
What happens if someone Rejects the task?
Do you even need a Rejection Option?
Depending on what you'd like to do, it could be really wonderfully easy, or a tiny bit more work. Either way, it would be good to be a bit clearer on the desired end-game.
Its a majority rule deal.
The options are: Approve, Reject, On-Hold, Postpone
Project 1 send for approval: rejected Comments: Too expensive
Project 2 sent for approval: approved Comments: Please proceed, no changes
Project 3 sent for approval: On Hold Comments: Please fix "X" and re will revisit
Generally the decision will be the same across the board.
Notification e-mail would go through the list of projects for that day and send out the results in a table format
Well then it sounds like you could probably, based on the outcome of the Flexi-Task, populate some type of one or many Outcome columns, which will then be used to collect data from by a workflow that runs at the end of the day (assuming that you wanted it to be a bulk 'all projects at once' type of thing), aggregating your information into that table format you suggested.
If you just wanted the notification email to go out immediately afterwards, that's fine as well! You can just apply whatever logic to the branches of the Flexi Task's outcome.
This assumes of course that you do not need to capture each individual's selected Outcome Option, and are just concerned, ultimately, with the final outcome. If you are wanting to capture each outcome then a secondary workflow will certainly need to be implemented, and the looping will need to start. See this thread for reference: though, there are very few instances that I can think of where the individual outcomes would matter in the face of the final outcome.
Either way, the separation of concerns (SOC) is achieved, and with a few generic workflows can handle 0 ~ Infinite number of Project Meetings.
Does this sound like it could appropriately handle what you're trying to achieve?
note: If you need a refresher course on the strangeness of Flexi-Task Majority Rule outcomes, see: Do you really know the Flexi task?
Here's another thought...continue to use the scheduled site workflow, but only allow the collection variable to contain one item from whatever list query you use.
Create a Y/N choice or checkbox field in the item that is updated to 'yes' or true by workflow action just prior to the flexi task action. Commit pending changes. Then add an action that starts a new instance of the same workflow. You need to insert this action before the flexi task action. Otherwise it will needlessly wait to start another instance of the workflow until the assignee(s) act on the flexi task created in this current workflow instance. It will now run the list query again, but one less item will be available to the query because part of the query is to determine if that new field does NOT equal yes.
Higher up in the workflow, just before the 'For Each' action (for each item in the collection variable--which, for us, will always be one), determine if the collection variable is empty--i.e. nothing met criteria. If it is, branch off to a line that no longer executes the flexi task...your workflow is done. Yes, you'll have an instance of the scheduled site workflow generated for each item that meets the query criteria. Yes, they will all remain in progress until the assignee acts on the task. If those aren't concerns, then, I think this will address the need.
For us it was the need to have assignees confirm or cancel a room reservation if it is 30 days out or less. As there could always be more than one such reservation, I couldn't have a site workflow wait for the first flexi task to be completed before it generates another one sequentially for all the other reservations. Here is a screen capture of the workflow doing all this...