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
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:
- In InfoPath, create a new browser-compatible form template or use an existing one.
- Publish the form template to a SharePoint form library.
- 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.
Figure 1. Include data for active form only on the Data Connection Wizard in InfoPath 2010.
- 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.
- 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.
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.