Since I've been talking about template parts quite a bit of late I wanted to show some examples of the most common ones that we created. We are not talking about anything fancy but common ones that are used a lot. With each example I'll give a little explanation on other things that have been done to the template parts that aren't visible from the pictures.
All the blue examples were built by me and all the nice looking ones were built by our new designer.
As you can tell we took the heading piece from InfoPath layouts a little further and built something little more specific for our situation. All fields in the template part are automatically pre-populated when a form is opened. The date field is populated with the "Today" function but the other 3 fields are populated from a secondary data source. The secondary data source is a web service that queries AD to retrieve the current user display name and company values. The web service that's used has a parameter that wants current user login name and for this InfoPath "UserName" function is used. The "Location" dropdown list values are retrieved from a SharePoint List but the active value is populated from the web service.
Things that were done part of the template part were Arial 12 formatting for all text and controls, specifying the data connections for the web service and SharePoint List and the binding of the dropdown list. The actual queries and setting of values are done in the startup rules of the actual form. Just the 3 tasks that this Form Template part does saves use a tremendous amount of time when you are talking about hundreds of forms.
When we started to look at the forms they wanted to convert we noticed that most of them had address blocks. One of their requirements for the address blocks was having the capability of specifying and updating any values for states or provinces and countries or regions. One nice thing we didn't have to worry about was data validation for any of the fields. We ultimately decided to use SharePoint Lists for both the State/Province and Country/Region dropdown list fields.
Things that were done part of the template part were Arial 12 formatting for all text and controls, data binding of dropdown lists and specifying the data connections for State/Province and Country/Region. Both of these dropdown lists values are pulled from SharePoint Lists because the SharePoint Lists gives the customer the flexibility to change the values whenever they want. The actual queries happen in the startup rules of the actual form.
A couple of things that we didn't do that could have been done in this template part would have been data validation for the Zip/Postal Code and Phone fields but it wasn't necessary at this point. If it does come necessary then all we have to do is update this template part and then import it back into the InfoPath Designer and re-open each form and then update the control.
The last example that I have to share at this moment is an approval template part. We use this for allowing people to approve the content of the form instead of using Workflow Tasks. It was decided to do it this way because then all the information would reside in the forms and not in different locations.
Things that were done part of the template part were Arial 12 formatting for all text and controls, conditional formatting for the checkboxes, text wrapping settings for the multi-line textbox, conditional formatting and rules for the approve and reject button, and data connection that is used for submitting the form.
You might be asking why we have an approval form template part and the reason is because the customer didn't want to use workflow tasks and wanted all the information stored in the XML. The workflows that we use are very simple and usually only send emails to people to approve or reject forms and to the individual who submitted the form to advise them if the form was approved or rejected.
Well those are probably are most common template parts at this point and like I said before nothing fancy but just very common things that are used a lot.