Display who last modified an InfoPath form in a SharePoint form library

Learn how you can use a reference to the SharePoint form library in which an InfoPath form is stored to find out who was the last person to modify the InfoPath form and display this

ADVERTISEMENTS

Suppose you want to create an InfoPath SharePoint solution that includes a field on an InfoPath form to display the name of the person who last modified the InfoPath form stored in a SharePoint form library.

There is a little known and seldom used check box on an InfoPath data connection for a SharePoint list, which is called Include data for the active form only and which you can use to refer back to the SharePoint form library an InfoPath form is stored in to access any metadata for the form, including promoted fields and the standard fields that are found on every SharePoint document library.

The latter set of fields contains a field called Modified By, which you can query from within an InfoPath form as follows:

  1. In InfoPath, create a new browser-compatible form template or use an existing one.
  2. Publish the form template to a SharePoint form library.
  3. Add an InfoPath 2010 SharePoint list data connection to the SharePoint form library to which you published the form template, and while you are on the Data Connection Wizard, ensure you select Modified By as one of the fields to be included in the InfoPath data source (secondary), and that you select the Include data for the active form only check box.

    Include data for active form only on the Data Connection Wizard in InfoPath 2010

    Figure 1. Include data for active form only on the Data Connection Wizard in InfoPath 2010.

  4. Drag-and-drop the AccountId field under the pc:Person repeating group under the Modified By group under the d:SharePointListItem_RW repeating group under the dataFields group of the secondary data source to the SharePoint form library onto the view.
  5. Republish the form template to the SharePoint form library.

In SharePoint, navigate to the form library to which you published the form template and create a new form. Once you submit or save the InfoPath form to the SharePoint form library, and then reopen the form, your logon account name should be listed in the AccountId field.

Log onto SharePoint as a different user, modify and resubmit/resave the form, and then open the form again to verify that the AccountId field contains the name of the last user who modified the form.

 


Related Posts

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services