Good morning,
I'm basically trying to create a simplish expenses style form which has a collection of input text boxes for things like name, etc. and then a repeating table for a list of financial items associated with the expense request being captured.
I'm using qRules and I have it setup so that the main form data is submitted to a sharepoint 2010 list and that works perfectly. First I get qRules to generate a GUID and it stores that in a form field called Payment_Request_ID which it then inserts successfully into the data that is submitted to the main sharepoint list.
What I then want to do is submit the repeating table to a second list and this is where I am struggling. I have gone through the process of setting up the secondary mapping file which includes the repeating table and I then manually entered the XPath of the Payment_Request_ID field which I got by right-clicking it in InfoPath and selecting copy Xpath.
The secondary part of the data submission process is set to fire on the same submit button as the main submission but it is set to come afterwards, so last in the chain of rules. I.e. the Payment_Request_ID has already been generated and is visible on the form.
When I try to test this, the first stage main data is stored correctly however the second stage financial items data does not get submitted and the following error is given back from qRules.
Action: SubmitToSharePointList. Arguments: submit:
PaymentElements_ShPSubmit
mapping: mapping2
. Details: Error occurred
generating the batch element
Details: Object reference not set to an
instance of an object.. Stack: at
Qdabra.GenerateBatch.GenerateBatchElement(List`1 docs, XmlNamespaceManager
docsNsMgr, XmlDocument mapping, String qRulesListId)
at
Qdabra.Tools.RulesLibrary.Commands.SubmitToSharePointList(String submitDs,
String mappingDs, String id, String dsname, String xpath, String name, String
uniqueName)
at
Qdabra.Tools.RulesLibrary.Commands.SubmitToSharePointList()
at
Qdabra.Tools.RulesLibrary.Commands.ExecuteCommand()
If I remove the Payment_Request_ID mapping from the mapping file it does not generate the error and the financial items are submitted but without the Payment_Request_ID that is necessary to marry them back up to the original request.
Obviously there is some issue with it not being able to bind to the Payment_Request_ID field on the form but I can't see why as I have found a few forum posts on here which kind of describe what I am doing as being possible with qRules.
Here is a copy of the secondary mapping file.
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdServerInfo="http://schemas.microsoft.com/office/infopath/2009/xslt/ServerInfo" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-27T15:29:00" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-gb">
<my:Mappings>
<my:IsRepeating>true</my:IsRepeating>
<my:RepeatingGroup>my:myFields/my:group1/my:group2/my:Payment_Element</my:RepeatingGroup>
<my:Mapping>
<my:FormField my:IsRichText="false">my:Payment_Element_Name</my:FormField>
<my:SharePointColumn>Payment_Element_Name</my:SharePointColumn>
</my:Mapping>
<my:Mapping>
<my:FormField my:IsRichText="false">my:Payment_Element_Value</my:FormField>
<my:SharePointColumn>Payment_Element_Value</my:SharePointColumn>
</my:Mapping>
<my:Mapping>
<my:FormField my:IsRichText="false">/my:myFields/my:Payment_Request_ID</my:FormField>
<my:SharepointColumn>Payment_Request_ID</my:SharepointColumn>
</my:Mapping>
</my:Mappings>
<my:SharePointListURL>http://sharepoints:48554/crap</my:SharePointListURL>
<my:FullListURL>http://sharepoints:48554/crap/Lists/tblPayment_Request_Elements</my:FullListURL>
<ListCollection>{74E4ECB9-6019-463B-B58C-4591DC1B7D7B}</ListCollection>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name="Payment_Element_Name" />
<Field Name="Payment_Element_Value" />
<Field Name="Payment_Request_ID" />
</Method>
</Batch>
</my:myFields>
Many thanks in advance,
Rob