Click here to Skip to main content
Click here to Skip to main content

SharePoint Designer Complex Workflow

, 28 Apr 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
SharePoint Designer Complex Workflow. Shows how to repeat steps in SharePoint designer

Problem

SharePoint has a complex workflow without using code. Out of the box, SharePoint provides four workflows, and one of them is approval. In my problem, we had four approval levels, each having rights to reassign, or approve.

Out of the Box Workflow Challenge

The challenge with the out of box workflow was that:

  • Reassign option works in a weird way, i.e. approve after reassign moves the workflow to the next step rather than to the previous step from where it came.
  • If reassigned to requestor, then requestor has the option to approve rather than resubmit.
  • The approver has the option to reassign to anyone but in our problem we want to restrict it to group for a particular approver.

SharePoint Designer Workflow Challenge

The problem with the SharePoint designer workflow was that it doesn’t allow repeating the steps which was important as per our requirement of reassigning.

Solution

Out of the box workflow was not at all a choice for us as it was not suiting the requirement. With SharePoint designer, there were challenges as mentioned above, but it seems to be more promising and efficient as it doesn’t require any coding and there was quite a lot of flexibility in this.

In order to avoid the challenge of repeating steps in SharePoint designer, following is the trick:

Step 1

Open SharePoint designer, and click on New -> Workflow

CreateNewWork-Step1.JPG

Step 2

Make sure to select automatically start workflow when item is created or changed. Here is a trick. The workflow will be kicked off whenever items get changed, which means in order to repeat the steps, I need to set some value in the object which will do the job for me. If you are still confused, see below for more details:

CreateNewWork-Step2.JPG

Step 3

In the figure below, you will see if condition for “CurrentStateField”, this field exists in the target object. In order to kick off workflow again, we will set the value wherever required. If you see, there is another variable currentstate (don’t confuse this variable with the field). This variable is used to manage state of the workflow, and the following action will be based upon this variable only.

WorkflowStep1-Initilizer.JPG

Step 4

In this step, we wait to collect the data from the director (e.g. bob in this case). Once we get the data, we set it into another variable called user response.

WorkflowStep2-Director.JPG

Step 5

Based upon user response, we set the current state variable value:

WorkflowStep3-DirectorActionStatus.JPG

Step 6

This is a little bit tricky, and needs careful study to understand. Once director reassigns in the last step, it needs input from the requestor. If you see in the first action, it is waiting to collect the data from the requestor if the last state was director reassigned. Now if the requestor Resubmits (by mistake it was written reassign from requestor), then after getting the user response, we set the current state to waiting for director approval which is a repeat state. Now in order to go back to step 2 (submit to director), we need to change the value of object so that workflow can be kicked off again. Last set statement in the first action does the job, i.e. assigning value to the current field in the object actually kicks off the workflow.

WorkflowStep4-DirectorActionResponse.JPG

This is very important to understand while writing the complex workflow with the SharePoint designer.

I hope the above information will help you in writing the complex business workflow. If you need a sample workflow/this workflow or more information, please contact me at varun_jain786@yahoo.com.

History

  • 28th April, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Varun Jain 786
Software Developer (Senior)
United States United States
Sr Developer (Passionate Developer)
varun_jain786@yahoo.com
 
http://sites.google.com/site/varunjain786main/
http://www.linkedin.com/in/varunjain786

Comments and Discussions

 
QuestionCould this be adapted to be used as a renewal notification process? Pinmembercdoyle2327-May-09 6:05 
AnswerRe: Could this be adapted to be used as a renewal notification process? Pinmembercdoyle231-Jun-09 6:12 
GeneralRe: Could this be adapted to be used as a renewal notification process? PinmemberVarun Jain 7861-Jun-09 18:20 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pinmembercdoyle232-Jun-09 3:46 
GeneralRe: Could this be adapted to be used as a renewal notification process? PinmemberVarun Jain 7863-Jun-09 13:08 
GeneralRe: Could this be adapted to be used as a renewal notification process? PinmemberMichieL D11-Jun-09 5:48 
GeneralRe: Could this be adapted to be used as a renewal notification process? PinmemberMichieL D30-Jul-09 0:11 
In the meantime I figured this out and it is possible. However, as this creates a lot of changes in the library, I will move this workflow to Visual Studio in a later stage.
GeneralRe: Could this be adapted to be used as a renewal notification process? Pinmembervsefcik26-Aug-09 12:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 28 Apr 2009
Article Copyright 2009 by Varun Jain 786
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid