How to Update an Existing SharePoint list item using a CAML Query to the SharePoint Lists web service from an InfoPath form.
The major steps involved are:
1. Create Initial InfoPath Form
Create the initial form template, main data source and retrieve the required details from the SharePoint list
2. Set up the CAML query
Create the CAML query using U2U for assistance with field identifiers. Additional information is provided about column identifiers for SharePoint lists in CAML queries in the post InfoPath CAML - SharePoint column identifiers. If you are updating Date/Time fields (or others which require a specific format) in the SharePoint list, you may find that the CAML query is not updating the SharePoint list item. If the format of a date/time value in a CAML template is incorrect, the update will not take place and any reamining updates will also be ignored. For details about the required date/time format when updating the time component in a SharePoint date/time field, see InfoPath - CAML Date Time format in when submitting to a SharePoint list via a Web Service.
3. Set up InfoPath Data Connections
Set up the data connections required to retrieve the blank CAML template from an XML file and another to subit the data back to SharePoint to update the existing SharePoint list item.
4. Set up the Form Template and Required Code
Set up the template to populate the CAML template with the required values, the submit programmatically using the secondary data connection.
Optional Steps and additional information:
Update Repeating Field elements in the CAML Template Programmatically
This can be useful when you need to set values in the CAML template without displaying a full repeating table with controls. As the CAML template has a repeating "Field" element for eacch field in the SharePoint list that requires updating, you can loop through each element to find the one where the name attribute matches the required.
How to Submit using a Secondary Data Connection in InfoPath
Submitting using Secondary data connections can be useful when you need to submit to multiple locations, or only submit to specific data sources based on form criteria and rules. To do this, secondary data connections can be set up for each required destination, which can then be executed individually using rules attached to form fields and controlls or programmatically.
For full details and additional notes/troubleshooting, see InfoPath - Update Existing SharePoint List Item Programmatically Using CAML.