You are on page 1of 7

www.qdabra.

com Page 1 of 7

QDABRA QRULES V2.0

How to use the SubmitToSharePointList command


The SubmitToSharePointList command features the ability to submit data from an InfoPath form to the SharePoint list it has been mapped to. It also allows updating of an item in the SharePoint list from the form by populating a field specified in the command with the SharePoint list item ID. This command requires the use of Qdabras InfoPath to SharePoint List Tool to obtain the XML file that will be used for mapping the fields in the InfoPath form to the columns in the SharePoint list. Refer to this blog post for in-depth instructions on how to use the tool. Follow these steps to obtain and inject the mapping.xml file in your InfoPath form template and be able to use the SubmitToSharePointList qRules command. As an example, we will use a simple InfoPath form template (injected with qRules v2.0) that has a repeating table with the fields: id, title and value:

We will then map these fields onto our SharePoint list which also has three columns:

1. 2. 3. 4. 5. 6.

Launch InfoPath to SharePoint List Tool and go to the Define Mapping tab: In the Source XSN field, attach the InfoPath form template (XSN). Enter the root SharePoint site in the Target SharePoint Site URL field, e.g. http://SharePointSite Click on the Get SharePoint Lists button. In the SharePoint Lists dropdown, select the list you wish to submit items to, in this case, My Renamed List. Click on the Extract Schemas button.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 2 of 7

7. 8.

Since were using a repeating group in our form, we will have to check the box Data is from repeating group in the Mapping Definition section. Click on the icon to display the Schema Tree taskpane and select the repeating group for your data, which in this case is my:myFields/my:group1/my:group2

9.

Click on the icon in each Form Field row to select the fields from the Schema Tree taskpane, and then select the corresponding SharePoint Column to map the fields to.

10. When done mapping, click on the Save As qRules Mapping button. 11. Save the mapping as an XML file in your local drive. In this example, we will leave the default name as mapping.xml, although we can use any filename. 12. Once done, close the tool and open the form template in InfoPath Design mode. 13. Go to Tools > Data Connections and add a receive data connection. 14. Select XML document as the source of your data and browse to the mapping.xml file thats been saved in Step 11. 15. Leave the default to include the data as a resource file in the form template and allow automatic retrieve on form open. For simplicity, we will call this data connection mapping. 16. Add another data connection that submits data to a Web Service since SharePoint uses a web service for the list methods. The URL should be: http://SharePointSite/_vti_bin/lists.asmx where <SharePointSite> is the root site where the SharePoint list is.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 3 of 7

17. In the list of operations, select UpdateListItems.

18. For the listName parameter, select the ListCollection node from the mapping secondary data source:

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 4 of 7

19. For the updates parameter, select the Batch group node:

20. Select to include the updates parameter as an XML subtree, including selected element:

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 5 of 7

21. We will name this data connection as ShPSubmit. 22. Add a rule to the Submit button to set the value of the QdabraRules Command field into SubmitToSharePointList /submit=ShPSubmit /mapping=mapping /id=my:id Note: When specifying the /id parameter and the data is from a repeating group, it should be the relative XPath to the ID field in the form. If an xpath is not found, the column in SharePoint will be blank.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 6 of 7

23. Finally, in Preview mode, try submitting new list items by filling out the Title and the Value fields and clicking Submit. You should see that the item gets submitted to the SharePoint list it has been mapped to and returns the list item ID back in your form.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

www.qdabra.com Page 7 of 7 To update the existing items in the SharePoint list from the InfoPath form, enter the list item ID and the new values, then re-submit. Both the SubmitToSharePointList command and the InfoPath to SharePoint List Tool will not work with attributes. The fields you are trying to submit to SharePoint need to be elements.

Copyright 2009 Qdabra Software. All rights reserved.

Revised: 2011-03-15 3:41:07 PM

You might also like