Monday, January 25, 2010

Create Association Form with People Picker

Step1:
Open The Infopath Form Template and create new with enable browser compatible check box checked.
Step2: Create the DataSource:
a> Add group named Service Approval with right click on my fields.
b> Now with right click on Service Approval Add the repeating group named Person.
3> With right click on Person Add three fields named DisplayName, AccountId, AccountType like below screen shot.



Step3: Add the another group named DepositApproval in myfields.
Step4: with right Click on Person in ServiceApproval click on Reference. after clicking this new window open like:




Select the DepositApproval group and click OK. The repeating group People copied to the DepositApproval group.

Step5: Drag and Drop ServiceApproval group and click on ContactSelector.



Step6: Repeate step4 for DepositApproval.



Step7: For Association Form Add the Submit button on Form and create a Context.xml file. To create this file open the notepad ,write given text and save it as xml format.



Step8: Add a Primary Data Connection:
On the infopath form select the Tools->DataConnection->Add->CreateNew Connection->Submit Data->Select To the Hosting environment->Next-> Finish.

Step9: Add a secondary data source XML file.
On the infopath form select the Tools->DataConnection->Add->CreateNew Connection->Receive Data->XML Document->Resource File->Add->Select the Context.xml File-> Click Ok-> Next-> Finish.



Step10: Add Datasource on Button. Double Click on the Submit button->Rules->Add->Add Action-> Select the Submit Using Data connecction and click ok. and again click on Add Action->Select Close The Form and Press OK.-> ok and Apply.



Step11: Security Setting is very important step for infopath form.
click on the Tools->Form Option-> Security and Trust-> select Domain-> OK.

Step12: Now on the Infopath menu : click File and then click on save as datasource.and also after that publich the form on Network Location->Next -> select the location-> Next-> delete the selected text->Next->OK->Publish-> Close.

Step13: Add the Published Form in the project.

Step14: open the command prompt and go to C:\Program Files\Microsoft Visual Studio 9.0\SDK\v3.5\Bin location where xsd.exe file exist. if there is no file than plz download the xsd.exe from internet.

write the following commands:
xsd /c /l:CS.
This Command create the myschema.cs file in C:\Program Files\Microsoft Visual Studio 9.0\SDK\v3.5\Bin location.



Step15: Add this myschema.cs file in the project and rename it same as the infoapth form.

Step16: Go to the Published infoapth form and in the file manu click on Properties. Copy the propertyID of the infopath form.



Step17: In the Project open the workflow.xml file and paste the id in tag as:




Step18: open the feature.xml file from the project and add the infopath form name in tag and add the form folder name (if all infopath form are in the Form Folder) in Properties tag like:



Step19: Build the Project, deploy it and than test.

1 comment: