Share via


Create Multiple InfoPath Forms in SharePoint 2010 List

Problem
Everyone, I was assigned a task to create an application in SharePoint 2010 for HR. This application would be used to higher contractors and employees so mainly it was Recruitment portal but nothing in this portal was external facing. It was to be used with company Intranet.

HR wanted this to be on the InfoPath form so that there can be more conditional formatting associated to it. Mainly for Contractor and Permanent Hire, my approach was to create two separate forms. In the long run, this would have created an issue as HR want to report on the same individual who was contractor before but later was hired.

This lead to the approach of creating multiple Content Types in the same list and then attaching different forms to it. I could not find a complete tutorial on this topic so here is what I found and implemented successfully.

**Solution
**

  • In the SharePoint 2010 site collection created for HR, create two new Site Content Types.
  • Create a content type for ContractorHire of List Content type and select Item as the parent content type as shown below.

  • Create another content type for PermanentHire of List Content type and select Item as the parent content type.
  • Create list called HiringDatabase. In the Advanced property, enable the Management of Content Type.
  • From List Settings, Content Type section, add the two content types created above. Change the order of the forms so that it looks like below:

  • Create few columns in this list. Remember to create columns such that they do not apply to both the Content Types and there is some difference, otherwise we will not be able to tell the difference in the form.

  • Once the columns are created, go to the List, in the List Tab on the toolbar, click on "Customize Form" for InfoPath. 
  • No changes are required to be made in the form as of now. Publish the form as it is and close it (Here we are customizing the form for the default Content Type which ContractorHire).
  • From the List Settings, go to Form Settings. Change the Content Type and select PermanentHire and click OK.

  • You will see that the fields on this form look different from the previous form and they only pertain to the PermanentHire Content Type. No changes to be done as of now, Publish the form and close it.
  • But here is an issue, now if you click the New Item from the list, and select either ContractorHire or PermanentHire, it opens up the same form and does not differentiate between the Content Types. This is because, when you published the forms for the two Content Types, it created both of them with the same name i.e. newifs.aspx, editifs.aspx and displayifs.aspx. Another reason is that the path to these forms is the same for both the content types and need to be changed.
  • To resolve this, open SharePoint Designer 2010. Connect to this HR site.
  • On left hand Navigation, Go to All Files > Lists > HiringDatabase (list that you have customized for this purpose). You would see that the Content Types you have created are list here.
  • Click on each of the Content Type and you can see the associated forms inside it.

  • You can verify that the same name forms exist in the PermanentHire folder as well.
  • On the left Navigation, click on List and Libraries > HiringDatabase. In the Content Type section, click on PermanentHire Content Type.
  • On the right hand  Forms section, change the URL to reflect the PermanentHire folder instead of the default ContractorHire Folder.

  • Save the Content Type settings page. 
  • Now when you refresh the list, and create item with the PermanentHire Content Type, you will see only the set of fields that are associated with this content type. Keep on adding the fields till the form is completed. 

Hope this clearly explains the way multiple InfoPath forms can be created for Multiple Content Types in a SharePoint 2010 List.