Hi all,
I am brand new to InfoPath but have had SP experience. I followed these two articles to update a custom SP List with values from my InfoPath forms fields:
http://www.infopathdev.com/forums/t/4055.aspx
http://blog-sharepoint.blogspot.com/2009/07/infopath-update-repeating-elementsnodes.html
I know the ListName GUID matches up as every time I hit submit a new item is created. But the item is blank because the CAML nodes are not being updated, even though after following the article in the 2nd link I get no errors.
The CAML secondary receive data source:
<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name='Title'></Field>
<Field Name="First_x002d_Name"></Field>
<Field Name="Employee_x002d_ID"></Field>
<Field Name="E_x002d_mail"></Field>
<Field Name="Work_x002d_Phone"></Field>
<Field Name="Job_x002d_Title"></Field>
<Field Name="LOB"></Field>
<Field Name="First_x002d_Choice"></Field>
<Field Name="Second_x002d_Choice"></Field>
<Field Name="Third_x002d_Choice"></Field>
<Field Name="Fourth_x002d_Choice"></Field>
<Field Name="Unable_x002d_To_x002d_Attend"></Field>
</Method>
</Batch>
All the fields were copy pasted from the SharePoint column GUID's. In the same method all the myFields nodes names were copy/ pasted from the CAML. The script that I am using is this:
//Select all nodes from the CAML XML Data Source - Declare outside of
//updateXMLDataSouce function, otherwise it will be set every time
//the function is called, which is once for each repeating element
var xmlDataSource = XDocument.GetDOM("CAML_XMLt");
var UpdateXML = xmlDataSource.selectNodes("/Batch/Method/Field");
function updateXMLDataSource(XMLFieldName, sourceField)
{
var count;
//Loop through each element in the data source to find the
//required field in the CAML template
for (count = 0; count « UpdateXML.length; count++)
{
//Test if the name attribute of the current
//element matches the required field
if (UpdateXML[count].getAttribute("Name").localeCompare(XMLFieldName) == 0)
{
//Element Found: Update the value of current
//element to the value of souceField parameter (XPATH)
var DSNode = XDocument.DOM.selectSingleNode(sourceField);
UpdateXML[count].text = DSNode.text
}
}
}
I seem to be stuck here; the empty node CAML object is inserted to the SP List and myFields are not transferring using the above script. Even though all fields are identical.