Move items between two InfoPath list boxes (no code)
Watch this InfoPath 2013 demo video of how you can use rules to move items between two list box controls on an InfoPath form without having to write code.
While you could write code in InfoPath to move items between two list boxes on an InfoPath form, you could also use rules to visually achieve the same result and make the changes applied to the list box controls stick.
The following InfoPath 2013 with SharePoint 2013 video demonstrates how you can use rules to move items corresponding to SharePoint tasks between two list box controls on an InfoPath form. You could extend this solution with a SharePoint 2013 workflow to loop through the items that were selected in the second list box just like you would loop through selected items in a repeating table.
Brief instructions to create such a solution are available in the InfoPath 2013 Cookbook 2 Club.
InfoPath 2013 with SharePoint 2013 demo video transcript
Here I'm in SharePoint 2013, where I've got this Tasks SharePoint list that contains these 5 tasks. I've also already published an InfoPath form template to this SharePoint form library. So if I click new document to add a new form, you'll see that when the InfoPath form opens, it will display these two list box controls on it and these two button controls, which are currently disabled. The first list box control contains the 5 tasks from the Tasks list.
The idea is that I would like to select an item here in this Available Tasks list box and click on this button to move the task over to the Selected Tasks list box. I could select a second item and move that item over, and a third item, and move that item over. If I wanted to remove items from this Selected Tasks list box, I would have to select an item in it, and then click on this button to move the task back to the first list.
While you could write code to provide such functionality; you might have to write maybe 40 lines of code to do so; this solution in particular is a codeless solution that makes use of only 4 rules and you could set it up in maybe 5 minutes or less.
I'll save the InfoPath form back to the SharePoint form library. Remember that we selected the Second Task and the Fifth Task. I'll close the form. And then when I open the form back, we should see the Second Task and the Fifth Task still listed in the Selected Tasks list box. And we do.
See more InfoPath 2013 tutorial videos »
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 of S.Y.M. Wong-A-Ton. 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, S.Y.M. Wong-A-Ton.
Related InfoPath Articles:
- Programmatically move items between two lists in InfoPath using C# code
- Bulk convert InfoPath forms to Word documents in SharePoint 2013
- Update SharePoint tasks by looping through a repeating table on an InfoPath 2013 form
- SharePoint Designer workflow loop through people picker
- People picker data merging in InfoPath 2013