Click here to Skip to main content
15,881,248 members
Articles / WebForms

SharePoint Designer Complex Workflow

Rate me:
Please Sign up or sign in to vote.
4.67/5 (7 votes)
28 Apr 2009CPOL3 min read 48.7K   32   8
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)


Written By
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? Pin
cdoyle2327-May-09 5:05
cdoyle2327-May-09 5:05 
AnswerRe: Could this be adapted to be used as a renewal notification process? Pin
cdoyle231-Jun-09 5:12
cdoyle231-Jun-09 5:12 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
Varun Jain 7861-Jun-09 17:20
Varun Jain 7861-Jun-09 17:20 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
cdoyle232-Jun-09 2:46
cdoyle232-Jun-09 2:46 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
Varun Jain 7863-Jun-09 12:08
Varun Jain 7863-Jun-09 12:08 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
MichieL D11-Jun-09 4:48
MichieL D11-Jun-09 4:48 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
MichieL D29-Jul-09 23:11
MichieL D29-Jul-09 23:11 
GeneralRe: Could this be adapted to be used as a renewal notification process? Pin
vsefcik26-Aug-09 11:35
vsefcik26-Aug-09 11:35 
Can you explain how you got this to work, or perhaps post your workflow? I have the exact same need (send email after an expiration date or when the expiration date is changed). Thanks.

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

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