Friday, March 25, 2011

InfoPath: Setting default formatting for controls per view

When you are busy designing an InfoPath form, you normally have a certain look and feel you want to implement: font, font size, font colour, etc.  One also tends to have different settings for different controls, like list boxes, buttons, rich text boxes, etc.  And it can be quite time consuming to go and set each of these controls to the desired formatting over and over again.

Luckily there is a way to set all the default formatting of the controls on your current view in one central place.  To get to the View Properties dialog, do the following, depending on which version of InfoPath you are running.

InfoPath 2007:
  1. Go to Views in the task pane and select a view
  2. Now click on "View Properties" below the view selection box
InfoPath 2010:
  1. Select the Page Design tab on the Ribbon
  2. Now click on "Properties" under the View Name
A dialog box will appear.  Select the Text Settings tab. 


You can now set the formatting defaults to all the controls you will be using.  Unfortunately, you will need to repeat this process for every view on your form.

Cannot update promoted fields from Library for InfoPath form update

I have recently been testing an upgrade to an existing site and came across a phenomenon that had me completely stumped.  To give you an idea of what I was dealing with, the existing system has:
  • An InfoPath form
  • 2 Promoted fields linked to existing columns in the Forms Library
  • A Nintex workflow to change the value of the above promoted fields in the Forms Library
We made a change to the form and gave it a new version – Version 2.  The Updated system would now have:
  • 2 InfoPath content types installed (Version 1 and Version 2)
  • Version 2 promotes two different fields to the same columns in the Forms Library as Version 1 mentioned above. 
  • The same Nintex workflow runs against Version 1 and Version 2 of the form. 
Having 2 InfoPath forms installed meant that I had to make sure that I still had data integrity whether using Version 1 or Version 2 of the InfoPath form.  This is where the problem came in...

PROBLEM:

As I mentioned earlier,  the Nintex workflow would be updating the Form Library columns where the InfoPath fields were promoted to.  But as I ran through the system I realised that, while the workflow was still updating the promoted fields for the Version 1 form, it wasn't doing the same for Version 2 forms.

I tried everything from logging extra notes in the workflow history to make sure the workflow actually tries to update Version 2 to changing the fields that the workflow was updating, you name it!  Well, it finally came to me.  One connection lead to another connection and BOOM – LIGHT BULB! 

SOLUTION:

When you publish an InfoPath form and you have a promoted field, by default a user cannot edit that field directly in the Form Library.  It is a read-only column.  But, if you modify the Column you want to promote, you will see a tick box option available to you:
"Allow users to edit data in this field by using a datasheet or properties page"
When you select this option, you make the field value editable in the Form Library.  For a detailed explanation of how to set this option, see David Gerhardt's blog: Promoting Editable SharePoint Columns.

My problem was that, where the InfoPath form Version 1 promoted fields had this option ticked when it was published, the new fields being promoted in Version 2 did not, and that caused the conflict.