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.
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:
Open SharePoint designer, and click on New -> Workflow
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:
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.
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.
Based upon user response, we set the current state variable value:
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.
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 firstname.lastname@example.org.
- 28th April, 2009: Initial post