tags:

views:

31

answers:

2

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.

+1  A: 

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.

popester
A: 

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
F.Aquino