Scenario

For Approval workflow, We can use SharePoint in-built workflows or SharePoint designer workflows. Suppose if your client is not agree to use SharePoint designer workflows in your project then the only option is to go with in-built workflows but SharePoint in-built workflow has certain limitations. Let’s see in detail.

  1. We have to specify the Approvers before the workflow starts (Static) or the user manually start the workflow and then specify the approvers.
  2. Several Email will be triggered automatically once the workflow is started.
  3. We can’t send InfoPath form via workflow Email .
  4. Second level of approval process is tedious.

In my requirement, I should not use SharePoint designer workflows or Object Model code. Only  Infopath  is allowed in my Project. So my ultimate choice is to play with InfoPath.

I have to design Infopath form in Form library. It has to go to two levels of approval on submission. Infopath form should be attached in approval Email. The Managers should have approve the Infopath form from Email itself. Once the Manager is approved the form, it should automatically go to the Higher level Manager for second level of approval through Email. 

Solution

I have designed "Document Submission" InfoPath form and it should go for two levels of approval as shown below . Let's see in detail

Documents Submission Form :



 (Fig A)


This form is going to be accessed by three user groups such as Developer, Manager and Level II Manager. We have to specify roles for each user group and apply the rules to each roles. I’m going to apply rule in such a way that

  • The users who are all having "Developer" Role can only fill the form
  • The users who are all having "Manager" Role can access only their approval section(See Manager Approval section in Fig A) other field should be read-only for him
  • The users who are all having "Level II Manager" Roles can access only their approval section(Level II Manager Approval) other field should be read-only for him.

The below diagram explains the above scenario



Fig B

Well, I know you have question in mind where to create roles and how to apply rules in Infopath form. Let me explain in detail.

How to Assign Roles?

The roles for each user will be mentioned in XML file. So whenever the user logged in  the Infopath form, it will take the user id from userName function (available in Infopath) and retrieve the Role(User/Manager/Level II Manager) of the user from the XML file, based on the role it will disable/enable the fields.

 Refer the below link to retrieve the values from XML using web service in InfoPath

http://www.codeproject.com/Articles/165438/Getting-XML-Data-from-Webservice-to-Infopath

How to Apply Rules?

We have to write rules in Infopath to disable/enable the fields based on Roles.

Steps:

  1. Right Click the Field.
  2. Go to Conditional Formatting.
  3. If the Role is equal to “Manager” then only the Manager approval fields (See Fig a:) should  be enabled.
  4. Apply the Conditional formatting for each and every field.



Approval Request Email

 Once the user submits the form it should go to Manager for first level of approval through Email (Manager Email given in the form). See the below Email Data Connection wizard.


Assign “Manager Email” field in “To” field.

After Submitting the form, Email will be sent to Manager with InfoPath form attached. In the "Submit" button , we have to write the following Rules

  • If user logged in  is "Developer", then the form should be submitted in Document library and Email should be triggered to Manager .
  • If user logged in is "Manager", only the Manager Approval section should be enabled .
                    -If the Form is approved, Email Should be triggered to Level II Manager
                    -If the Form is Rejected,  Update the status in Form library as "Rejected" . No Email should be triggered to Level II Manager.
  • If user logged in is "Level II Manager", only the Level II Manager Section should be enabled.
                    -If the Form is approved/Rejected, Email Should be triggered to Developer

First level of Approval

The Manager who received the Email can approve/reject the attached InfoPath form. Only the Manager Approval Section is enabled. So he can click Approve/Reject button in Manager approval section only. Once the form is approved it will go to Level II Manager for approval.

Second level of Approval

Once the form is approved by Level II Manager, the Level II Manager approval and comments fields will be updated in SharePoint form library.

Conclusion


We can easily create two level of approval workflow in InfoPath form by following the above steps.