Time-Off Request Solution: Adding a Document Information Panel

This is the third installment in a four-part series about the time-off request solution, an end-to-end Microsoft Office SharePoint Server 2007 solution that uses Microsoft Office Word 2007 as a form application. In the previous post I built an Office Word 2007 document template using content controls and associated it with the Time-Off Request site content type. This post focuses on the document information panel and its ability to drive business logic in the form without any custom code.

The document information panel is a Microsoft Office InfoPath 2007 form template that is associated with a content type. This solution already uses a default document information panel, which you saw when opening the time-off request document template. The default document information panel displays all of the site columns in the Time-Off Request site content type. To create a new document information panel for this site content type:

  1. Navigate to the Site Settings page for the site collection (in this case, the Human Resources site collection).
  2. In the Galleries section, click Site content types.
  3. In the Custom Content Types section, click Time-Off Request.
  4. On the Site Content Type page, click Document Information Panel settings.
  5. On the Document Information Panel Settings page, click Create a new custom template.
  6. On the Document Information Panel Settings page, select the Always show Document Information Panel on document open and initial save for this content type check box.
  7. Click Create a new custom template.
  8. In the InfoPath Data Source Wizard, click Finish.

When the InfoPath designer starts, note that all of the site columns appear as fields in the form view. However, for this solution, the employee needs to edit only five fields, while the employee’s manager needs to edit only three fields. So, we can add a layout table (Insert | Layout Table) to the form view that displays only the editable fields. Nodes can be dragged from the Data Source task pane into the form view, which will result in the creation of controls that are bound to those nodes.

InfoPath Layout Table

One benefit to using a document information panel is the ability to connect to a secondary data source without code and then populate form fields with data received from that connection. This solution includes a custom SharePoint list within the Human Resources site collection that identifies time-off balances. Each list item has columns for the Employee, Manager, and—although not displayed in the list view—the Employee Email and Manager Email.

Time-Off Balance List

For this solution, you will change the Employee Name text box control in the document information panel to a drop-down list box control. Then, you will update the drop-down list box properties to look up values from the Time-Off Balances custom list. To make these changes, perform the following:

  1. Right-click the Employee Name text box control and click Change To | Drop-Down List Box.
  2. Double-click the Employee Name drop-down list box control.
  3. In the Drop-Down List Box Properties dialog box, click Look up values from an external data source.
  4. Click the Add button.
  5. In the first page of the Data Connection Wizard, ensure Receive data is selected and click Next.
  6. In the next page of the Data Connection Wizard, click SharePoint library or list and click Next.
  7. In the next page of the Data Connection Wizard, type the URL for the Time-Off Balances custom list and click Next.
  8. In the next page of the Data Connection Wizard, ensure Time-Off Balances is selected and click Next.
  9. In the next page of the Data Connection Wizard, ensure the Employee, Employee_Email, Manager, and Manager_Email check boxes are selected and click Next.
  10. In the next page of the Data Connection Wizard, click Next to not store a copy of the data for offline use.
  11. In the last page of the Data Connection Wizard, click Finish.
  12. In the Drop-Down List Box Properties dialog box, click the Select XPath button, located to the right of the Entries box.
  13. In the Select a Field or Group dialog box, expand dataFields, click Time-Off_Balances, and click OK.

With the InfoPath declarative rules engine, you can add logic to the document information panel that sets fields in the form’s data source based on the selection in a list. In this scenario, you will add a rule to the Employee Name drop-down list box control that sets the EmployeeEmail, ManagerName, and ManagerEmail nodes accordingly. To add the rule:

  1. In the Drop-Down List Box Properties dialog box, click Rules.
  2. In the Rules dialog box, click Add.
  3. In the Rule dialog box, click Add Action.
  4. In the Action dialog box, change the Action list value to Set a field’s value.
  5. Click the Select XPath button, located to the right of the Field box.
  6. In the Select a Field or Group dialog box, double-click the EmployeeEmail node.
  7. In the Action dialog box, click the Insert Formula button, located to the right of the Value box.
  8. In the Insert Formula dialog box, click Insert Field or Group.
  9. In the Select a Field or Group dialog box, change the Data source list value from Main to Time-Off Balances (Secondary).
  10. Expand dataFields and Time-Off_Balances, click the Employee_Email node, and click Filter Data.
  11. In the Filter Data dialog box, click Add.
  12. In the Specify Filter Conditions dialog box, change the first list value to Employee.
  13. Click the third list value and click Select a field or group.
  14. In the Select a Field or Group dialog box, change the Data source list value from Time-Off Balances (Secondary) to Main.
  15. Expand p:properties and documentManagement and double-click the EmployeeName node. Specifying a Filter Condition
  16. Click OK in all dialog boxes until you return to the Rule dialog box.
  17. Repeat Steps 3-16 for the ManagerName and ManagerEmail nodes.
  18. Click OK until all dialog boxes have been closed.

The InfoPath designer also allows us to add conditional formatting to the document information panel. For example, we can disable the three manager controls if the TimeOffStatus node is blank, which is the default value. This conditional formatting will prevent the employee from updating the Status, Reason (if “Rejected”), and Total Business Days fields when first filling out the time-off request. To add this conditional formatting:

  1. Double-click the Status drop-down list box control.
  2. In the Drop-Down List Box Properties dialog box, click the Display tab.
  3. Click Conditional Formatting.
  4. In the Conditional Formatting dialog box, click Add.
  5. In the Conditional Format dialog box, ensure TimeOffStatus is selected in the first list.
  6. Change the second list value to is blank and select the Disable this control check box.
    Adding Conditional Formatting
  7. Click OK until all dialog boxes have been closed.
  8. Repeat the previous seven steps for the Reason (if “Rejected”) and Total Business Days text box controls. For these two controls, in Step 6, select the Read-only check box.

You now have a document information panel that includes some relatively basic business logic. The next step is to publish the form template so that it will replace the default document information panel for the site content type. To publish the new document information panel:

  1. Click File | Publish.
  2. Use the Save As dialog box to save the form template to the local machine.
  3. In the first page of the Publishing Wizard, ensure As a Document Information Panel template for a SharePoint site content type or list content type (recommended) is selected and click Next.
  4. In the next page of the Publishing Wizard, click Publish.
  5. In the last page of the Publishing Wizard, click Close.
  6. Close Office InfoPath 2007.

Now, when you navigate to either the Time-Off Request or Time-Off Request Status document library and click New | Time-Off Request, the new document information panel will appear in the Office Word 2007 document template. When the employee starts a new time-off request document, he will not be able to modify the manager fields in the document information panel. Also, when he selects an Employee Name, the corresponding email and manager information is entered in the document.

In the final post about this solution, I will create Microsoft Office SharePoint Designer 2007 workflows that route tasks to the employee or employee’s manager as the time-off request document is updated.

10 thoughts on “Time-Off Request Solution: Adding a Document Information Panel

  1. I have finally followed all the sections through here…All appears to work fine until the request is actually submitted; then I see the workflow is stopped with the message:Error updating a list itemDocument is checked outI have checked the lists on the site and none appear to have any versioning, or requirement for docs to be checked out…Any assistance most welcome..John

  2. Hi, John.A SharePoint Designer workflow inherits the system properties of the user that triggered it. As a result, you need to make sure that the correct users have write (Contribute) access to the Time-Off Balances custom list. The vacation and/or floating holiday balances cannot be updated if the users cannot write to that list.Regards,David

  3. First of all congratulations for all the effort put in this document and teh way the steps are explainedI managed to follow succesfully until the part where you create the Document Information Panel. As soon as I click, “create a new custom template” Infopath opens and when I click finish (as instructed) I get an error (of which I can send you a screen shot) that basically says that it cannot create the customXSN.xsn and clicking OK will close the message box and obviously all stops there.I am using Windows Vista but when I tried it on a Win XP machine same error occuredIt must also be said that I am using Office 2007.Is there anything different form what you used in your case, and if not, have you got any cluse why I am getting this error )ideally I send you the screen shot)While I thank you for your help I eagerly await your replyThanksEamon Falzon

  4. David,I have implemented the Vacation Request Process to the full as per your instructions and all worked fine, however I have the same problem mentioned above by John. I have checked the rights and all seems to be fine. When I create requests myself it is OK but otherwise I get a message saying “Error updating a list item, Document is checked out” and finally the user ID always shows as “system account”. Wat else can I check for?John, how did you resolve the issue?Thanks once againRegardsEamon

  5. Hi, Eamon.As I mentioned to John, a SharePoint Designer workflow inherits the system properties of the user that triggered it. So, while you may be able to create requests because you have write access to both the “Time-Off Request Status” and “Time-Off Balances” lists, other users may not. So, modify the permissions for those lists accordingly and then try creating a request again as a different user.I hope this helps…Regards,David

  6. Great post. I have been looking for a solution that will do this for some time but haven’t been able to get one to do what we need it to do. I’m having the same problem as Eamon did/is. When I try to create a new custom template in the Document Information Panel, I get an error (after clicking Finish) similar to:Infopath cannot open the following form…..customXSN.xsn…The XML Schema of the form template is either invalid or contains a structure that Infopath doesn’t support. Details are: propertySchema0.xsd#/schema/element[1][@name = ‘properties’]/complexType[1]/sequence[1]/element[1][@name = ‘documentManagement’]/complexType[1]/all[1]/element[4]Reference to undeclared namespace prefix: ‘ns1’.I’m using Infopath 2007 and Word 2007 and I’ve tried it on two different machines with the same results. Any help would be greatly appreciated. Thank you.

  7. Please pardon me for sounding like a newbie, but I am one. I’ve tried working through the tutorial, but the first mention of the Time-Off Balances custom list is on this page. Is there anything special in setting it up, or just create the columns and a view to match what is shown? More importantly, would this list need to be manually created and maintained as employees roll on or off? I understand the need to manually update the number of total available days each year, but I am not sure to what level I can capture information that already exists. Thank you!

  8. Hi, Joseph.Yes, this is custom list that is manually maintained. Just add the columns as shown and be sure to include the “Employee Email” and “Manager Email”.Regards,David

  9. Thanks for the tutorial David. i was doing great until the intro of this custom list. Is there a page i missed that goes through setting up the time-off balance custom list? Do i need to create a new site content type for this page and just add the columns you have in your screen shot? Thanks for your help.

  10. Hi, Colin.You just need to create the custom list in the same site where the other document libraries are located. Add the columns as shown above and be sure to include the “Employee Email” and “Manager Email”.Regards,David

Comments are closed.