Thursday, January 19, 2012

Changing Default Infopath View of External Lists forms

Problem: If you have an external List in Sharepoint 2010 and you modified the default form with the Infopath Form, you may want to have a view for Edit mode where you show certain field or display the fields in a different layout than a View Form. You can do this by editing the newly created displayifs.aspx or editifs.aspx pages and change the view of the web part, but as soon as you save your change, the form does not work anymore.

After extensive testing and fighting, I was able to fix the problem. Here's a quick summary:

Open SP Designer and edit the View page which you want to change the default Infopath Form View. In this case, it will be the displayifs.aspx


 


Once in Edit mode, click on the Infopath Form Web Part, on the left bar look for the property "FormLocation" and copy the value. This is the main problem. As soon as we select a different view, Sharepoint Designer will assign an incorrect Form path and that's the reason of the error.


 



 

The right click on the Web part and select "Web Part Properties"


 



 

Change the view to your desired value and click OK.



 

Click again on the webpart and go again to the property "FormLocation" and you'll notice that now it is no longer pointing to a valid XSN.



 

Modify the value and paste the value you had copied in the first step. Save the page and you should be good to go.