Force Left Nav To at least 200 Pixels wide
Force Body To at least 500 Pixels high
SharePoint MindsharpBlogs > Kathy Hughes, MVP > Posts

 Single Post

Jun 29
Published: June 29, 2009 08:06 AM by  Kathy Hughes   Powered by: Mindsharp and Summit 7

Forms play a powerful part in a SharePoint implementation for obvious reasons. But which form solution is best for you - the OOB forms, InfoPath, customized .net Web forms or dataView/form Web part? It depends on a number of considerations, including requirements, server/infrastructure, licensing options, scalability and, importantly, education around what's available and what each option can do. For example, I get "oh, we knew about InfoPath but we didn't know it could do X,Y and Z". And it's rare that I come across an implementation that doesn't require some degree of form customization or an extension to or 'fix' of an earlier customization. I still think InfoPath is underutilized in a number of deployments I come across, largely from lack of knowledge about the product and its capabilities.

InfoPath's not something I work frequently with, but over the past few months I've accumulated a list of common questions I've received while working with customers on InfoPath slash SharePoint integration. I've added them to this post along with some publicly available reference points for others who might also be considering deploying InfoPath as part of their SharePoint deployment or revamping their existing deployment.

Remember, design - design - design for your InfoPath deployment. For example, you don't want users to have to manually enter their name and details when completing form/s especially where the form is deployed as part of an intranet. And it's not just about the design and business logic you build into the form itself but also about what you intend to do with the data once users start populating forms, especially in the case of SharePoint. For instance, how many form templates do you intend publishing to SharePoint and how are you going to manage those templates? What about the security model for completed forms in SharePoint, do you want other users to have the ability to see what data others are submitting - think web service, events and/or workflows on the destination library to reroute forms to a secure location. What information do you want to capture from the form - think about search and metadata, and surfacing relevant data from submitted forms, i.e. management overview, etc.

My recent presentation on InfoPath - "SharePoint Effectively Design Series: The Power of Forms in SharePoint" - can be found in the download section of this blog.

Commonly asked Questions about InfoPath | SharePoint integration

Q/ How do I move my form's data connection/s between development and production?

The most common way to do this is to modify the form's XML file directly - see http://blogs.msdn.com/infopath/archive/2006/11/01/relinking-forms-and-form-templates.aspx  

And if you're unsure how to access the form's XML file, you'll need to access the InfoPath File menu while in design mode and select Save As Source Files...

Q/ How can I use user roles and views in browser-based forms?

By default, browser-based forms don't support user roles or views. However, there are a few ideas floating around. I haven't tried this myself, but there's a related blog post here - http://sharepointsolutions.blogspot.com/2009/04/how-to-emulate-user-roles-in-infopath.html.

Q/ I have another database I'm currently using to submit part of the information I'm looking at including in my InfoPath form. Should I continue to enter that data separately to that database or include it in the form? I want to be able to create trends around the choices the user enters.

I'd include it as part of the form, i.e. fields within the form. This way, you can then promote those fields as columns when you publish the form to SharePoint and surface that information which you can then include in SharePoint search and subsequent KPI's or other custom Web parts.

Q/ How can I make an existing populated field read-only?

This is something you really want to consider doing where you don't want other users modifying existing data within a form. For example, where a form is submitted for a workflow, etc., and you may choose to make some fields or the entire form ready-only. Another typical example I've encountered is where I've pulled a user's details from Active Directory and dynamically populated the fields on the form with that user's info. I don't then want to have that those fields updated (overwritten or clobbered) with details of the next user who opens the same form.

The best way OOB to achieve this is to use conditional formatting to make the fields read-only if field X, Y and/or Z is populated. For example, add a condition to a field so that if the field is not blank then make it read only or trigger a read-only condition based on the value of another field within the form.

Q/ How can I remove the validation dialog from online forms (this dialog often causes usability issues when it conceals underlying fields on the form)?

The only way I know of to do this is to modify the core.js file on the SharePoint Web front-end server. There's a related post on how to do this - http://sharepointfeaturesandfailures.blogspot.com/2008/03/turn-off-hover-over-screen-tips-on.html.

Q/ How do I dynamically populate my form template with user information, e.g. username, user e-mail, based on the logged on user?

Adding the current logged in user's information to a form is good design sense and is commonplace in intranet scenarios. Unfortunately, there's no direct way to add user information to a form other than an OOB function called "userName" which will fetch the current logged in user's name and populate the bound field on a form. But this then doesn't go automatically fetch the remainder of the user info, such as Manager, phone, etc.

userName function

The "userName" function can be called by adding an Action to a text box field:

Double click the text box and click Rules

In the Rules dialog, click Add then Add Action

From the Action drop-down, select Set a field's value

Then set the Field to the text box field to which you want to display the username

Next, click the fx symbol to the right of the Value field and in the Insert Formula dialog click the Insert Function... button

In the Insert Function dialog, under Functions, locate and select userName, then click OK

Back in the Insert Formula dialog you should see userName() in the Formula section

For further details, see http://blogs.msdn.com/infopath/archive/2006/05/26/608092.aspx  - check out the last comment on that post which refers to having the userName value change each time the form is opened yet the guy asking the question wants to save the original name entered in the form. This is something you might want to do in the case of including an historical record of who's opened the form or a welcome dialog.

More commonly used methods

For more robust user detail populations, two other options are available. One option is to pull user information directly from Active Directory. The other is to leverage the SharePoint profile service.

Ben Walters recently posted a demo on how to access user profile from Active Directory and embed that profile information into an InfoPath form, which leverages the LDAP webservice available from CodePlex:

http://msmvps.com/blogs/benwalters/archive/2009/04/21/accessing-active-directory-from-an-infopath-form.aspx

Here are a couple of posts relating to receiving user information from the SharePoint web services:

http://blogs.msdn.com/infopath/archive/2007/03/07/get-the-user-profile-through-moss-web-services.aspx

http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx

My preference if integrating InfoPath with SharePoint is to leverage the SharePoint profile web service.

Q/ I want my form to be embedded (open and ready for data entry) within a Web page rather than users having to click the 'New' button from the toolbar within the Forms library. How can I do this?

One option is to use the XML Form View Web part. There's a related post available here - http://sharepointfeaturesandfailures.blogspot.com/2008/03/turn-off-hover-over-screen-tips-on.html.

Q/ If I add an attachment control to my form, can I have any subsequent form attachments exposed as one of the columns in my SharePoint Forms library?

Not OOB, i.e. if you attempt to promote a column based on the attachment type you'll get a base64Binary error dialog. This is because the base64 data type isn't supported as a promoted field column in SharePoint. We had the same issue back in InfoPath 2003 and SharePoint Portal Server 2003.

Here are a couple of posts with suggestions on how to achieve this (I haven't tried either of these and I'm not sure if they are specific to a client side or Forms Services solution):

http://social.msdn.microsoft.com/Forums/en-US/sharepointinfopath/thread/f2b78cee-4a47-4d05-b3af-60b376718717

http://www.bizsupportonline.net/blog/2009/02/submit-file-attached-infopath-form-as-attachment-sharepoint-list-item/

Q/ I know I can submit an entire form back to my SharePoint Forms library using a custom submit button, but what about submitting the data from a form to a SharePoint list?

This post and comments - http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Add-SharePoint-List-Items-with-InfoPath.aspx  - provides a good overview on submitting InfoPath data to SharePoint via the SharePoint list web service (lists.asmx).

Q/ How can I dynamically populate other fields on my forms based on the value selected from my SharePoint (receive) data connection?

This is pretty straight forward. All you need to do is set up your receive data connection to the desired SharePoint list on your field (for example, using a drop-down list control) and then set up a rule (on the same field) for each value within the field so that when a value is selected, other fields are populated with values according to the selection in the first field.

For example, if current field is equal to "value", add action to set field X's value to "value".

Q/ When I add my receive data connection to my list box controls, I get an annoying blank line inserted at the very top of the box. How can I remove that line?

You can do this by directly modifying the form's view xsl file and removing the </option> tag.

InfoPath Resources

There are a lot of resources available, but here are a few links to help:

MSDN InfoPath labs - http://blogs.msdn.com/infopath/archive/2007/03/09/infopath-2007-training-labs.aspx

Microsoft InfoPath blog - http://blogs.msdn.com/infopath/

InfoPath Dev blog - http://www.infopathdev.com/

InfoPath Development Center - http://msdn.microsoft.com/en-us/office/aa905434.aspx

MSDN InfoPath Forms Services forums - http://social.msdn.microsoft.com/Forums/en-US/sharepointinfopath/threads

<Submit this form! />



 Comments

No comment(s) to show

 Add Comment

* Required Field
Your Name *
Your Blog Url
Message Subject *
Message Body *