Modifying fields for a Workflow Task in Sharepoint - 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.

Related

Running SharePoint 2013 Manual Workflow triggers List Update workflow

I have a SharePoint 2013 list, within it I have a workflow that starts when a list item is updated. This workflow emails people regarding a data change to the list.
I also have a second workflow on that list that can only be run manually which will do some reporting on demand for an item on the list (user checks an item, goes to Workflows, and runs it).
The problem is: When the second manual reporting workflow runs, it also causes the list item update workflow to trigger, which in turn spams my users when no real data change occurred (other than the workflow status field), or at least, it's not a data change that I care about.
Question: How do I prevent the "update workflow" from starting when I'm running the manually-started reporting workflow?

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).

sharepoint 2007 workflow trigger

I have an initial workflow in Sharepoint Designer that triggers whenever an item is created and also whenever an item has changed in the 'Employee' list .
Within second workflow I am updating the 'Employee' list and the workflow above is triggered.
Is there any way I can check in the intial workflow if the item has been updated by a user or if it was updated by a workflow. In the case if the item was updated by a workflow I would not want to trgigger it.
Many Thanks,
Through SharePoint Designer, you cannot cause an update to an item to not trigger workflows that are listening for it. But, you can cause the workflow to basically be skipped with one extra Step.
Try checking out this article at Microsoft Office, which discusses secondary workflow interactions in SharePoint Designer. In the first step, it identifies whether an item was created by a specific workflow, and cancels the workflow if it isn't. We just need to adapt this - if we successfully identify the item as being modified by your secondary workflow, then we want to cut off the first workflow.
You need to create a new Step in your initial workflow, and move it to the top. In it, choose the Compare Tasks Condition. In that condition, set field to be "Workflow Name", leave the operation as "equals", and set value to be the name of your secondary workflow. Then, add a Stop Workflow Action, specifying some appropriate workflow history message to indicate that the workflow was triggered by the secondary workflow so it was terminated.

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.

Block SharePoint workflow from running unless prerequisites are met

I've got a scenario where I want a workflow to not run if a certain condition is true, otherwise to run when a list item is created. The scenario is for a people management system. If a new list item (staff member) is added to the list then the workflows job is to go between the various departments and get everthing setup. Eg payroll, IT account ect. One of the fields is Start Date that may or may not be entered. If it is entered then I don't want the workflow to run when the item is created. I want the policy on the list to start the workflow on that date. I can add some code into the workflow to end itself if the date is in the future but then this will show as completed on the list. This is a problem because the workflow shouldn't show that it's run as in effect it's waiting for the date to be correct.
In other words, is there something in onWorkflowActivated that allows me to stop the workflow from triggering so that nothing shows up in the site, in essence to suppress the workflow from running as if it was never triggered by the OnCreated event.
Can you add a new step at the beginning of the workflow to fill in the Start Date? I think this makes sense in terms of your workflow because the HR person has an action item on their plate: enter the start date.
Otherwise you could make Start Date a required field on the sharepoint list.
This is SharePoint Designer version, see if you can use the same activities in VS
Create a second workflow that executes the rules after StartDate is set
In the main workflow, create a step with the action 'Wait for Field Change in Current Item' and config it to 'StartDate not Empty'.
The next action will be a 'Start Workflow', executing the second Workflow you created.
You also have a Stop Workflow activity

Resources