Sharepoint Designer 2007 - Workflows and secondary workflow relationships - sharepoint

A little background: I work for a company that produces a product that has a workflow for projects with many "concurrently" running tasks. For this discussion, lets say that Project A creates 4 Sub-projects.
Both the main project and the 4 subproject workflows will create tasks in the main task list. The main issue that I am having is how to associate the tasks created by the subproject workflows back to the main project.
For instance:
Project A is created in the Projects list. This list has ONE workflow associated with it called "project start". This workflow is a manual start workflow which when started then creates the four subprojects in a subprojects list - these subprojects need to run concurrently hence why I have created them in a secondary list with their own workflows. The subprojects list has 4 workflows associated with it to manage the 4 subprojects - each of these "auto-start" when the subprojects are created in the subproject list.
So anyway, to save some typing I will refer to the subprojects as UNITS 1 - 4.
I create Project A and manually start it's workflow. The project start workflow creates the Unit 1, Unit 2, Unit 3 and Unit 4 items in the subproject list (at the same time because, as I said earlier, these items need to run concurrently). Each of the unit manager workflows start and begin creating their to-do tasks in the tasks list. I am using the "assign a to-do item" task activity because all I need to know for the workflow to progress through it's steps is whether or not the work is completed.
Once all 4 Unit workflows have completed, the Project Start workflow will now begin to manage the final portions of the project prior to completion with additional task items (manager approvals and so on).
Now the issue I am having is that the view I have set up for the task list shows the "title, start date, end date, completion status and link" columns. The link column shows a link that refers back to the creating list item. For this example, the Unit 1 manager workflow operates on the UNIT 1 item that was created by Project A. So for "example task 1" that was created by the unit manager workflow, the link is "Unit 1". This is not entirely helpful because when someone looks at their task list they could have multiple "example task 1"'s from multiple projects. Displaying UNIT 1 as the referencing master item means nothing to the user. What I want displayed is the Master Project title so that they can sort their tasks by project. Sorting by "Unit x" means nothing.
Now my initial solution was to create a "project" column on the task list. In this column, I could create another subworkflow that all it would do would be to look up the initially created project by looking up and referencing workflow and item id's and set this new "project" variable to the initiating master project (project a - for this example). That workflow WORKS!
However, and this seems to be an issue that is "not uncommon"in MOSS 2007, having this subworkflow running on the task list can (and has) created multiple lock errors which show - "this item cannot be modified as it is locked by an already running workflow". This error grinds the workflow to a halt and is not an error that is recoverable. I have researched this error and it is an unavoidable error that has no single and easily deployable solution. It has something to do with the backend databasing and how/when it stores the update task item variables and so on. Once the workflow locks, you're done.
So, what I really need is a clever solution to associate the main project with any and all subtasks. If the task is created by the "project start" workflow, that is done automatically because the "link" column auto-associates this task with the creating item...which in this case is "project a" - easy enough. However, because of my NEED for the additional subitems on a separate list with their own workflows.....I lose that reference.
Is there a way to associate the tasks created from the subproject list workflows to the main project without having to call another subworkflow to set that variable. (ie: a way to avoid the "this item is locked by a running workflow" problem).
I think I am thinking too hard on this solution and can no longer see the forest for the trees.

Unfortunately I think your solution is to stop using SharePoint Designer for this workflow. Either look into purchasing a 3rd-party workflow product for SP2007 or build a workflow feature in code using Visual Studio.
You want to get to a position where 1 workflow can do everything you're talking about: run on a project and create 4 parallel branches, each which create tasks exactly how you'd like (with a Project column) rather than the very limited options you have from SPD.

Related

How to create items in child list and trigger a child workflow from a Parent workflow

I want to know if we can have a parent workflow which when called leads to spawning of multiple child workflows. Is there a way we can actually implement it in SharePoint. So basically I want to use a part of my parent workflow to trigger another workflow - this particular workflow can be associated to the same list and sometimes they can be associated with different lists and libraries...will that cause any problems.
It would be awesome if you guys can share your thoughts and ideas regarding this topic.
So how I expect it to work :-
Let's say when something triggers workflow A it goes and spawns multiple items in the SharePoint list which triggers workflow B. And all the newly created items are running workflow B. Also if there is a way to call another workflow C which is linked to another library.
If you are using SharePoint 2013 or later:
Add a column to the list with a name like WFBtrigger or WFBstatus. Set it to default to "" or "Not run" or similar.
Create your Workflow A. When it's finished have it update WFBstatus to "Pending" or similar.
Create your Workflow B. Set it to start when the item is created. Add a Loop. In the loop wait for WFBstatus to change to "Pending". Do "B's" work. Update the WFBstatus field to "Done".
Now when A is triggered, B will shortly there after run.
To trigger C in another list, just have A or B update a "WFCstatus" column in the C list and have a workflow C waiting for that column to change.
So I have got some great news ! I was able to figure this one out but It is not exactly very direct
So SharePoint Designer allows you to create an item in another list using the create function. I have attached a screenshot
click here to view
So using this functionality you can create an item in a completely different list or the same list. But this has one problem- Once you actually create an item on the child list using a 2013 workflow it will not trigger the workflow in the child list. So this has been explicitly disabled to prevent a condition called Workflow recursion. So is there a way around it ?
Yes ! you have two options:-
1.Call the Rest Endpoint for the child workflow, Sample approach : https://blogs.msdn.microsoft.com/sridhara/2014/08/21/fix-sharepoint-2013-workflow-recursion-prevention-part-2/
2.Use MS Flow to create the flow in the child list
Hopefully it helps someone out there !
PS: For some weird reason for our company we cannot create 2010 workflows- apparently 2010 workflows are not supported in modern sites (I maybe misinformed)

Edit a SharePoint lookup field link from the linked "child" record

I have two lists in SharePoint, one each for projects and tasks, that I need to relate through the use of a lookup field.
If I create the lookup field in the project list then I can assign multiple tasks to the project and easily see what tasks are assigned to the project and click through to the project. I cannot, however, see what project tasks are assigned to in the task views.
If I create the lookup field in the task list, then I can easily choose which project to assign it to and I can sort or filter the task list view by project using the values in the lookup field, but I can't easily see which tasks are assigned to any given project in the project list view.
If I have to choose one or the other, the latter is the better option since the list of projects is shorter than the list of tasks and I can always filter on the project name in the lookup field column in the task list view.
Ideally, however, I would like to easily be able to see which tasks are assigned to a project from within the project list view, and maybe even edit the relationship from there.
Is there any way to do this in SharePoint?
Thanks!
it will work if you keep the 2 lookup but I don't recommend that the other way around is to create a custom listing web part thru SharePoint API and get the tasks related to each projects
So far the following solution seems to be working pretty well and does not involve the use of any new web parts or custom code.
I have the lookup field (with select multiple disabled) in the task list (the child list).
As stated in the question, the lookup list for the projects is much shorter and easier to use than the lookup field for the tasks. This also allows me to go into the tasks list view and filter on the lookup field (which is also a link to the respective project).
To facilitate easy access to the tasks for any given project, I added a link field to the project and link to the list view that is filtered for that particular project's tasks.
This keeps the list structure simple but allows me to quickly jump between the two lists.
Thanks!

Add fields to Sharepoint Workflow Task

I'm currently making a pretty simple approval workflow in sharepoint using sharepoint designer. One of the design goals that we have for this workflow is that we want to minimize the amount of custom coding that we have to do so I'd appreciate answers that involve using sharepoint designer instead of whipping out VS.
So the workflow should start when a person adds an item to a list.
When the workflow kicks off it would create a task and and assign a due date of +2 business days and assign the responsibility to a group of users
When a user completes the task then it would record the individual person who completed the task as well as the date it was completed.
It's pretty easy to add fields to the list but the purist in me kind of balks at this since these fields would be null and it violates first normal form. Ie a list that went to Task1 but not Task2 would have four fields Task1ApprovedBy, Task1FinishedDate, Task2ApprovedBy, Task2FinishedDate and both the Task2 fields would be null.
--edit--
Sorry If I'm not being clear about the question. I'm using Sharepoint Designer and I would like to update a list item in a lookup when a user completes a task item. How do I select the last task for a particular item that was completed and update that last task two values "Completed By" and Completed Date values? I'd prefer to do this on the Task list since that would also make reporting easier. I'd just create a view on the Task list instead of doing some type of join between the two list to when a particular task was completed.
Thank you for the help!
Jason
It sounds like you need two workflows here. One on the "Main" list and one on the "Tasks" list:
The first workflow is tied to the "Main" list. It fires when a user creates a new list item in the "Main" list. This workflow simply creates a new item in the "Tasks" list (with the correct people assigned, description, dates, etc...)
The second workflow is tied to the "Tasks" list. It fires whenever an item in the Tasks list is changed. The workflow checks to see if the status field is "Complete". If it is, then assign the "Completed By" field to the current person editing the task and assign the "Completed Date" value to today.
(Note that, in a SharePoint Designer workflow, there is no way to evaluate the properties of the list item prior to the update. If a completed task is updated, the SPD workflow will be unable to determine that the task was already completed. Basically, each update to a completed task will update the Completed By/Date fields. If you want a more complex workflow - which only updates when the status is changed to "Complete" - you will need to use Visual Studio).

SPWorkflowCollection on SPListItem is always empty

I'm having a problem relating to Sharepoint workflows and the associated task list.
I have 2 custom workflows that we created for our product. They both use the same Task list that has a custom content type that inherits from the Task content type.
Now I have a case where a running workflow has been deleted via the list has been deleted or the document, this results in orphaned tasks.
I want to overwrite the Task lists OnDeleting event, so that users can cleanup their tasks so that it won't contain unneccessary orphaned tasks. So my item deleting looks like this
public override void ItemDeleting(SPItemEventProperties properties)
{
SPListItem currentListItem = properties.ListItem;
}
The problem is that when I go into debug mode and check the currentListItem.Workflows.Count field then it's always 0. It doesn't matter which workflow I initiate or what task i look at, the SPWorkflowCollection returned is always empty :(
I was wondering if this might be related to a bug in our custom workflow where it's not wired up properly (but it finishes correctly and tasks are deleted when a workflow is terminated) or am I looking at this the wrong way ?
The currentListItem you have in scope here is the task item itself, not the list item that the workflow is running against. The task doesn't have a workflow running against it, so the zero count is expected.
If you're trying to get to the workflow tasks associated with workflows on an item you're deleting you'd need this kind of event handler on each list the workflow is activated on, not on the tasks list the workflow uses to store its tasks.

Modifying fields for a Workflow Task in Sharepoint

Does anyone know how you can modify the fields in an out-of-the-box (OOTB) Workflow Task (specifically Priority and Due Date)? The OOTB Approval workflow doesn't allow you to set these fields (it allows setting a due date, but not a due time).
I had a cunning plan to create a custom workflow in Visual Studio to set these fields automatically. This involved attaching my custom workflow to the tasks list and editing the tasks as they were created by the Approval workflow. However my custom workflow doesn't fire when new tasks are added to task list by the Approval workflow. And it seems you are unable to manually trigger a workflow on an item in the task list that was created by a workflow.
So in order to set the task fields as they are created by the Approval workflow I'd have to somehow hook into the OOTB Approval workflow directly, which I'm not sure is possible.
Obviously another option would be to recreate the Approval workflow from scratch with InfoPath and Visual Studio, but this seems like overkill to just add priority and time fields to the instantiation form.
Any thoughts?
I've just realised you can edit field such as priority and due date (time) from the task list by selecting Actions > Edit in Datasheet. This works for normal task list items and those created by workflow.
I'd still like to know why a custom workflow that is set to trigger on new items in a task list doesn't fire when a workflow adds items to the task list.
Note: To edit the time a task is due you need to modify the OOTB task list so that the Due Date field is a Date and Time rather than Date Only.

Resources