Getting List Item ID in InfoPath Form

A developer at a client is trying to do something that we thought should be very simple to do but are unable to figure out. She is trying to create an InfoPath Form for their RFC Process and store it in a Form Library. However, she wants to display the List Item ID within the InfoPath Form as read-only to use it as the RFC Number. She understands that this field will be blank for new Forms. However, she is unable to display it even for existing Forms. She is also unable to map an InfoPath field to the List Item “ID” column. Any suggestions on how to resolve this?




SOLUTION:

Create a field called as ListID on the IP form and expose it as a dependency property when you publish the form. The following screen shot shows the details
1) During the publish Click Add to expose dependency properties


2) Add the listID field. Make sure to check “










3) Allow users to edit data in this field by using a datasheet or properties page
4) Publish the form





































Create a SharePoint Designer workflow that would be kicked when a new item is added to the list. Select the list and
1) Select the Action as Set field in current item
2) Click the field to select ListId and set the value to ID. See screen shot below








3) Complete the workflow and bingo it should work. Now when a new form is added to the form library the workflow should be kicked and it should update the listid field on the InfoPath

1 comments:

Cathy Ward said...

Good Article