In this exercise you will extend the previous workflow to implement the basic approval process using Visual studio2010 and Infopath2010.
1. Open (Last Post Project)in visual studio 2010:
2. In solution explorer expand Workflow1 and double click on Element.Xml file.
2. In the workflow definition file (Element.xml), set the TaskListContentTypeId attribute of the Workflow element to the following content type. This content type, included in Microsoft SharePoint Server 2010, specifies custom task display and edit forms that include an Office Forms Server control for rendering InfoPath forms.
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
3. Let us create task form using InfoPath 2010 through which an approver can approve and reject the request.
a. open InfoPath 2010 and select blank form in popular form templates then click design form button.
b. add title and controls from Home tab in ribbon as mentioned below.
c. right click on Fields pane on right side and select add then specify the field status as text.
d. In Data tab of ribbon select data connections and click add button.
e. select create new connection to submit data and click next button.
f. select to the hosting environment, such as an ASP.Net page or hosting application and click next .
g. Enter the name for data connection and then click Finish button.
a. Click close button.
I. Double Click on Approve button then on ribbon you will find Control Tools tab in this click on rules button.
j. Click Add button then select set field value
k. Again click on Add button and then select SubmitData.
L. Again click on Add button and then select Close the form.
M. Repeat all steps from I-L for reject button but set status to rejected while setting a field status.
N. Double click on close Button click rules click on Add button select Close the form.
O. Save the form with the name ApproveReject2010.
Publish the form:
To publish the form click on file tab on ribbon then select publish.
Select Network location Option then click on browse button. Specify the following location in file name and click ok then on this location make a new folder with name Forms.C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\WorkFlowLab1_Feature1 this is the location where workflow is published.
Specify the name Of File =” ApproveReject2010.xsn” Click ok then click next.
Clear the textbox on next screen then click next then publish and close the form.
Now go to the location C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\WorkFlowLab1_Feature1\Forms right click on approvereject2010 file then click on design this will open the published form.
Now on file tab on ribbon select Info then in right pane click on Form template Properties.
Copy the text in Id.
Close the form and return to visual studio2010.
3. Add an element to the Metadata element of the workflow template definition. This element is TaskID_FormURN Element (Workflow), where N represents the integer you assigned to that task type within the workflow. Set this element to the URN of the InfoPath 2010 form you want to use with this task.
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:ApproveReject2010:-myXSD-2010-08-22T06-49-46</Task0_FormURN>
In solution Explorer Expand Feature1 then double click on Feature1.feature.
Click on manifest then click on edit options.
Add <Property Key="RegisterForms" Value="Forms\*.xsn" /> tag under Peroperties tag and Click on overwrite generated xml link.
Click on Edit in XML editor link then add following Tags.as mentioned in screen shot below.ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"
2. Setup the auto association parameters that will tell Visual Studio to automatically associate your workflow with the TestList when it is deployed.
a. Select Workflow1 in the solution explorer.
b. In the Properties window, set the Auto Associate property to True.
c. In the History List property click the [...] button to start the wizard.
d. Click Next >, On the 2nd page select a list of Shared Documents in the first dropdown and click Next
e. On the final page check the first check box and clear the rest and click Finish.
Deploy the workflow to SharePoint and verify that it works.
f. Right click the project in solution explorer and click Deploy.
g. When the deployment is complete, open Internet Explorer and navigate to http://localhost/Shared%20Documents/Forms/AllItems.aspx.
Click on add Document link and then upload the document.
Click the drop down menu on the Expense Report in the list and select Workflows
Click the WorkFlowLab1-Workflow-1 link to start the workflow.
Click the In Progress link under WorkFlowLab1-Workflow-1 to track the workflow
Click on Task mentioned in Task List notice that task is associated with our custom content type defined by InfoPath ApproveReject from.
Hi Ikram,
ReplyDeleteThis is not working, Can you help me to fix it?
Error is
"There has been an error while loading the form.
Click Try Again to attempt to load the form again. If this error persists, contact the "
Thanks,
Hi Ikram,
ReplyDeleteI am very very very sorry, Its working !!!!!
Thank Q very Much Ikram.
How can you Solve above error ? can you explain it?
DeleteThanx alot it helped me accomplish my task :)
ReplyDeleteCan you suggest how can i display custom columns of doc library in this screen
I wonder ! you would have been posted about how to set "correlated Token for create task and how to assign the task through code behind.
ReplyDeleteThe way you started this post is really simple to learn after publishing infopath,as i beginner i am clueless.
Its not working properly :-(
ReplyDeleteThere has been an error while loading the form.
ReplyDeleteClick Try Again to attempt to load the form again. If this error persists, contact the support team for the Web site.
Click Close to exit this message.
Show error details
The specified form cannot be found.
Correlation ID:470bf18a-3299-4a49-bc3f-c4ce8a001d6f
Hey I got This Error when i deploy it.can you please help me...?
its Urgent
Please use the Pcname in url instead of localhost or 127.0.0.1 and enjoy
ReplyDeletegoogle
ReplyDelete