Workflows & Scenarios

SharePoint provides a set of workflows:

  1. Out-of-the-box Workflows
    1. Approval
    2. Collect Feedback
    3. Collect Signature
  2. SharePoint Designer Workflows
  3. Visual Studio Workflows
    1. Sequential
    2. State Machine

“People are often confused what should be the best workflow for given scenario.”

I would suggest the following Priority of choosing workflows:

  1. Go first with Out-of-the-box workflow
  2. If not possible, Go with Designer workflow
  3. If still not possible, Go with Visual Studio workflow

Scenario 1: Document Approval

Following is a simple use case:

  1. Employee creates a Document
  2. Document needs Approval from Manager
  3. End of Workflow

Solution

We can use the Out-of-the-box workflow to address the scenario.

  • SharePoint Approval Workflow

image

Even if multiple Approvers are needed, we can still use the Approval workflow.

image

Scenario 2: Expense Submission

Following is a another use case:

  1. Employee submits Expense Item
  2. If Expense Amount > $1000
    1. Send Notification to Manager
    2. Else end the Workflow

Scenario Type: Sequential until Completion

Solution

There are no out-of-the-box workflows to address this scenario.

The type of workflows appropriate are marked in bold:

  1. Out-of-the-box Workflows
  2. SharePoint Designer Workflows
  3. Visual Studio
    1. Sequential Workflows
    2. State-Machine Workflows

Designer Workflow would include an If Condition and Email Action:

image

Scenario 3: New Employee Hire

This is a bit complex scenario.  Following are the steps involved:

  1. Candidate Submits Resume, which is captured in a List
  2. Forward to HR Manager
  3. HR Manager validates & proceed the document to Technical Interviewer
  4. Interviewer conducts Interview
    1. If Interview is Passed, proceed to Hiring Manager
      1. Hiring Manager proceeds with Offer Letter
      2. Candidate accepts the Offer
        1. Candidate joins the Company, Convert Candidate to Employee
        2. Proceed to Payroll Manager
        3. Proceed to Infrastructure Department for System, Email, Credential Allocation
        4. Notify Employee Manager
        5. End of Workflow
      3. Candidate rejects the Offer, End of Workflow
    2. If Interview is Failed, End of Workflow

Scenario Type: Sequential with Manual Intervention

Solution

The type of workflows appropriate are marked in bold:

  1. Out-of-the-box Workflows
  2. SharePoint Designer Workflows
  3. Visual Studio
    1. Sequential Workflows
    2. State-Machine Workflows

Please note that the above Scenario have a Sequential flow.

Visual Representation

We can visually represent the above steps as:

image

Status Column

We can introduce the Status column in various stages of the flow, as shown below:

image

The type of workflows appropriate are marked in bold:

  1. Out-of-the-box Workflows
  2. SharePoint Designer Workflows
  3. Visual Studio
    1. Sequential Workflows
    2. State-Machine Workflows

Designer Workflow would not be perfect fit for this scenario.  But we can create a Designer Workflow with multiple If Conditions & Email Actions.  

The tricky part here is to invoke the workflow on:

  1. Item creation event
  2. Item updating event

Additionally, we have to ensure a Resting State to prevent duplicate execution of Actions on the update event.

Following is the workflow Conditions & Actions within SharePoint Designer.

image

image
We need to make sure the workflow is invoked on creation & updating.

image

Please note the following:

  1. Designer workflow starts on item creation & stops after completing a condition & corresponding action.
  2. Another update even triggers a new workflow instance creation & stops after completing a condition & corresponding action.

State Machine Workflow would be perfect fit for this scenario as State change triggers the execution of set of actions. 

In the case of State Machine workflow, the Intermediate States are persisted.  Based on each state change, further actions are invoked.  Plus, a state can go back to a previous state creating a loop.

Summary

Out-of-the-box Workflows are preferred for the most cases.

Designer Workflows are the next option to Out-of-the-box Workflows, with less deployment hassles.

Visual Studio > Sequential Workflows are Good for Sequential Actions until Completion.

Visual Studio > State Machine Workflows are Good for State based Operations & Looping back.

Leave a Reply

Your email address will not be published. Required fields are marked *