qRules SubmitToSharePointList Command - Changes for v4.2 - Hilary Stoupa
in

InfoPath Dev

Hilary Stoupa

qRules SubmitToSharePointList Command - Changes for v4.2

The last time I blogged at any length about SubmitToSharePointList was when we originally released the command. With the upcoming qRules 4.2 release, this command is undergoing a pretty major overhaul, and I think some update posts are in order.

To start with, however, I want to assure you that we have worked very hard to make sure the command remains backward compatible. So, if you have a form that uses SubmitToSharePointList, and it works just the way you want it to – you can re-inject your form with qRules 4.2, and command will keep working. No changes needed on your part.

I intend to post a series of walk-throughs for the command, but to begin with, I’d like to simply talk about what is changing.

The Mapping Tool
This form has been revamped to allow you to create multiple mappings for a single template within the form. This means that if your form template is meant to map to multiple lists, you can create a single mapping file.

There are some caveats here – currently, you’ll need to map your form to the lists in the order you wish to submit them – while we have plans to simplify this even further, they are not in place for the 4.2 release. So, if you have, for example, a parent-child relationship in your form between a customer and the contacts for the customer, you’d want to map the parent first, then the child. qRules will submit (and refresh, if you use the RefreshSharePointListItems command) the mapping in order (unless you specify which mapping you wish to submit / refresh, more on that further down in the post).

In the mapping tool, you can indicate which field you would like to store the SharePoint list item id in – this replaces the /id parameter. You do not have to specify an id field, of course – there are use cases where you wish to only submit items from your form to the list, but not leave the form connected to the list item. If you have a field that contains attachments you wish to include with your list items, you can also specify those.

Id and attachment fields are not mapped to columns – if you select one of those options, you’ll instead see some help text on how those fields are used:

This form still functions in a stand-alone mode as well – including with multiple mappings. So, if you have a big bunch of XML you’d like to get submitted to your lists, you can use the form on its own. As a stand-alone form, however, the fields indicated as the id fields do not get updated, nor are attachments added to your list items.

We’ve also added an “Import Existing qRules Mapping” button – you can import any qRules mapping file with this functionality – whether 4.2 or earlier.

The Submit Connection
As in previous versions of the command, you'll need to create a submit data connection in your form to the UpdateListItems method of the SharePoint Lists web service. That web service URL looks like this:
http://myserver/_vti_bin/lists.asmx
With "myserver" replaced with your actual SharePoint server URL.

When you create the data connection, with qRules 4.2 you no longer have to select any values for the parameters - InfoPath will fuss, but you can safely ignore it: 

Click "Yes" to the warning and finish creating the connection - qRules will set the input parameters for you when you execute the command.

The Command Parameters
If you’ve used earlier versions of this command, the syntax will be familiar:

SubmitToSharePointList /submit={name of your submit connection} /mapping={name of your mapping connection} /id={XPath to your id field – relative for repeating}

The /id parameter is optional.

With the new mapping file format, you can indicate the field for your id from within the mapping – that’s because if you are mapping to multiple lists, the /id parameter would be insufficient. That is – if you had mapped to a Customers list and an Orders list in a single mapping file, and included an /id parameter – which SharePoint list would be populating that id? The Customers list? The Orders list?

By indicating the correct field for the SharePoint list item id from the mapping, the mapping file contains all the information qRules needs to populate your id field.

Since you can now have a single data connection to a single mapping file no matter how many SharePoint lists you will be submitting data to, the command no longer requires the /mapping parameter - if you name your mapping data connection mapping. If you name it mySuperFancyMappingDataConnection, you'll still need the /mapping parameter to indicate the correct data connection for the mapping file.

So, your command could be as simple as:

SubmitToSharePointList /submit={name of your submit connection}

Just one parameter, but with the ability to submit to multiple lists, and to populate your form with the new list item ids.

If you also want to submit attachments, you’ll need to create a data connection to the AddAttachments method of the Lists web service and include the /dsname parameter. You can indicate the fields with the attachments in the mapping tool.

Each individual list mapping will have a name – it defaults to the name of your list:

If you wish to submit to just a single list, even though your mapping file has multiple list mappings, you can include the name in the command:

SubmitToSharePointList /submit={name of your submit connection} /mappingName={name of your list mapping – in my screenshot above, it would be Customers}

If you were for some reason to map the same form to the same list twice – perhaps you had two different groups that needed to submit to the same list – the form will display the mapping name for the second instance of the list so you can adjust the name to something unique:

*************

So, that’s the basics – the mapping tool now allows multiple list mappings for a single template. You can indicate the old /id parameter in the mapping as well as the /xpath for attachments. The command itself can be greatly simplified, especially if you name your mapping data connection mapping and want to submit to all your lists at once. You can inject 4.1 forms with 4.2 – say you need to use some of the amazing new math, financial or string commands in 4.2 with a form that has been using the SubmitToSharePointList command – without any issues… the command is fully backward compatible. I should add - if you want to use separate mappings for each list, you certainly can still do that, with multiple mapping data connections in your form. But you can use just one submit connection for all of them - no more creating a submit connection for each list.

In the next couple weeks as we finish testing and prepare to release qRules 4.2, I’ll get more blog entries up on using the updated mapping tool and command - when qRules 4.2 is ready, you'll be ready too!

Comments

 

Hilary Stoupa said:

qRules 4.2 is coming soon, and with it - big changes to the SubmitToSharePointList command! But wait

June 1, 2012 10:27 AM
 

Hilary Stoupa said:

In version 4.2 of qRules, we made a number of changes to simplify the SubmitToSharePointList command

July 6, 2012 3:58 PM

About Hilary Stoupa

I wandered into development after working as a business process analyst for a global manufacturing company. I create InfoPath solutions for our clients as well as work as a developer on company tools that extend InfoPath. I've also been instrumental in creating the InfoPath Master Class training provided by Qdabra.

Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.