Submitting data to a secondary data source - InfoPath Dev
in

InfoPath Dev

Submitting data to a secondary data source

Last post 11-04-2015 08:32 AM by smsemail. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 11-02-2015 10:48 AM

    Submitting data to a secondary data source

     Hi,

    I saw the above question asked in 2010 and the help that was given proved to be helpful.  Hillary was patient and helped.   I am trying to update an existing record in a sharepoint list, when an InfoPath form is submitted.   

    On the InfoPath form, I have a drop down list with ID's.  The user select the record to update, by selecting the ID.  In the InfoPath form I need to pass the ID to the XML.  I created a rule that set the ID field's value with the ID selected from the drop down list.  Is this correct? What am I missing? Your help is appreciated.

    I followed the steps and I get the "Submit is successful" message.  But the record is not updated.  I do not think I am passing the ID correctly.

    My XML is the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update">
            <Field Name="ID"></Field>
            <Field Name="FirstName"></Field>
            <Field Name="LastName"></Field>
            <Field Name="Address1"></Field>
            <Field Name="Address2"></Field>
            <Field Name="City"></Field>
            <Field Name="State"></Field>
            <Field Name="PostalCode"></Field>
            <Field Name="Country"></Field>
            <Field Name="HomePhone"></Field>
            <Field Name="CellPhone"></Field>
            <Field Name="WorkPHone"></Field>
            <Field Name="Fax"></Field>
            <Field Name="DOB"></Field>
            <Field Name="SocialSecurityNumber"></Field>
            <Field Name="DriversLicenseNumber"></Field>
            <Field Name="LicensePlateNumber"></Field>
            <Field Name="VehicleMake"></Field>
            <Field Name="VehicleModel"></Field>
            <Field Name="VehicleYear"></Field>
            <Field Name="TaskSummary"></Field>
        </Method>
    </Batch>
     

    Thank you so much for your help

    smsemail 

  • 11-02-2015 03:39 PM In reply to

    Re: Submitting data to a secondary data source

    When you set up your submit data connection, did you select the entire batch node and the option to submit child nodes? Are you able to install any software on your machine? If so, you may want to try a free tool called Fiddler - it can capture web traffic and you'd be able to see what you are submitting and what is being returned - so that may help as well. Are you setting the ID to the List ID of an existing record?
    Hilary Stoupa

  • 11-02-2015 03:42 PM In reply to

    Re: Submitting data to a secondary data source

    Thank you Hilary.  I was able to figure out that issue, now I am getting: 

    Now I am getting the error:

    InfoPath cannot submit the form.
    Some rules were not applied.
    InfoPath cannot submit the form.
    An error occurred while the form was being submitted.
    The form definition (.xsf) file has an invalid mapping from the document to the submit Web service.

    What does this mean?  What am I missing?  My CAML looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update">
            <Field Name="ID"></Field>
            <Field Name="Address1"></Field>
            <Field Name="Address2"></Field>       
        </Method>
    </Batch>


     

  • 11-02-2015 03:46 PM In reply to

    Re: Submitting data to a secondary data source

    Hilary, 

     Also, how do I set the ID to the List ID of an existing record.  Can I do that by setting the field value? 

    Again, thank you so very much for your help. 

  • 11-02-2015 03:49 PM In reply to

    Re: Submitting data to a secondary data source

    Well - the trouble with setting the ID field is that InfoPath out of the box is not going to let you use a filter on the field when you pick it to set it. So you'll end up setting all instances of Field to the ID. You can modify the manifest file to add a filter, or you can modify your CAML XML to include some extra attributes (the UpdateListItems method will ignore them) - so, add another attribute to each Field node called "updateField" or whatever, and leave it blank. When you want to set the ID field to an ID, set updateField to 1 or go or whatever, and add rules to updateField that if Name = ID, set the field to the ID.... a little clunky, but it works.
    Hilary Stoupa

  • 11-02-2015 04:24 PM In reply to

    Re: Submitting data to a secondary data source

    Add another attribute to each Field node called "updateField" 

    Can you give me an example of what it should look like, just one will do:

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update">
            <Field Name="ID"></Field>
            <Field Name="Address1"></Field>
            <Field Name="Address2"></Field>       
        </Method>
    </Batch> 

    Again, thank you. 

  • 11-02-2015 04:31 PM In reply to

    Re: Submitting data to a secondary data source

     Hilary,

    Just want to say...thank you for helping.  Much appreciated!  

    smsemail 

  • 11-02-2015 04:35 PM In reply to

    Re: Submitting data to a secondary data source

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update">
            <Field Name="ID" updateField=""></Field>
            <Field Name="Address1" updateField=""></Field>
            <Field Name="Address2" updateField=""></Field>       
        </Method>
    </Batch> 

    Hilary Stoupa

  • 11-03-2015 10:11 AM In reply to

    Re: Submitting data to a secondary data source

    Hi Hilary

    Looking at the blog you advised that I look at, which I used,  I am confused as to where I need to receive my data from for the CAML XML template. I had first thought XML Template, but that do not make sense. 

    Since I am updating an exist record in a SharePoint list, should I be receiving my data from the SharePoint List that I want to update or from SOAP web service for my XML Template? 

    Step 3 (below) of the blog does not indicate this :

    Step 3: Add a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2. (Make sure the options “Include the data as a resource file in the form template” and “Automatically retrieve data when the form is opened” are enabled.) 

    How is my XML template populated?

    Thanks again for your help. 

    smsemail 

     

     

     

     

  • 11-03-2015 10:31 AM In reply to

    Re: Submitting data to a secondary data source

    I'm sorry. I don't really understand the question. To submit data to a SharePoint list using the UpdateListItems method of the lists web service, we need to submit CAML. That is what the CAML XML that you add to your form template as a data source is for - that is what has to be submitted to the list. As to how you get values into the CAML XML prior to submitting - well, there are different options. In the blog post I suggested you look at for help setting up your submit connection, they are putting a control on the form bound to the XML data source they are submitting to the list service. In one of these threads that you have going (can't remember if it is this one or the other thread) - I suggested you add a helper attribute to your CAML XML to use for adding rules to set the fields in your CAML XML. Regardless - to use the UpdateListItems web service you need to submit CAML, which means you need to set the fields in your CAML batch to the values you need submitted.
    Hilary Stoupa

  • 11-03-2015 02:43 PM In reply to

    Re: Submitting data to a secondary data source

     Hilary,

    Thanks for your help  and patience...please bear with me.

    Sorry I sound confusing..

    This is what I did:

    I followed the directions of the blog and I followed your suggestion to add an attribute field "updateField" to the XML and I also added a rule to the "updateField"
    attribute.

    In the blog, you said that they "put a control on the form bound to the XML data source they are submitting to the list service".  Are you referring to the "ListName". 
    I added the field to the Main data source and populated the field with the GUID of the SharePoint list, but I did not but the control on the form.  Should I?

    When I submit the only field that is populated in the XML template is the ID. The other field are not.  I posted an image of the xml results in the DEBUG view/xml resuts

    My XML template looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <Batch OnError="Continue">
        <Method ID="1" Cmd="Update"> 
            <Field Name="ID" updateField=""></Field>    
            <Field Name="FirstName" updateField=""></Field>
            <Field Name="LastName" updateField=""></Field>
            <Field Name="Address1" updateField=""></Field>
            <Field Name="Address2" updateField=""></Field>
            <Field Name="City" updateField=""></Field>
            <Field Name="State" updateField=""></Field>
            <Field Name="PostalCode" updateField=""></Field>
            <Field Name="Country" updateField=""></Field>
            <Field Name="HomePhone" updateField=""></Field>
            <Field Name="CellPhone" updateField=""></Field>
            <Field Name="WorkPHone" updateField=""></Field>
            <Field Name="Fax" updateField=""></Field>
            <Field Name="DOB" updateField=""></Field>
            <Field Name="SocialSecurityNumber" updateField=""></Field>
            <Field Name="DriversLicenseNumber" updateField=""></Field>
            <Field Name="LicensePlateNumber" updateField=""></Field>
            <Field Name="VehicleMake" updateField=""></Field>
            <Field Name="VehicleModel" updateField=""></Field>
            <Field Name="VehicleYear" updateField=""></Field>
            <Field Name="TaskSummary" updateField=""></Field>
        </Method>
    </Batch>

    Again, thank you.  I know I am close...but something is still not connecting.

    smsemail 

     

  • 11-03-2015 03:27 PM In reply to

    Re: Submitting data to a secondary data source

    In the blog post I linked to, they put a repeating table on the form that was bound to the XML that you are displaying in your screenshot and in the XML you pasted in. You have a rule on the updateField attribute that is setting ID. You could add more rules to that field to set the other values in your CAML XML so that there is data to submit. If you manually enter values for the various fields in your Debug view prior to submitting to the UpdateListItems, leaving the ID set, and submit using your UpdateListItems data connection, does your list item get updated?
    Hilary Stoupa

  • 11-04-2015 08:32 AM In reply to

    Re: Submitting data to a secondary data source

    Hi Hilary

    No the list item does not get updated after I submit.  I get the message "Updated Successfully".  Now I am lost.  Wow.  What could I be missing? 

    Thanks for your help....and patience.

    smsemail 

     

Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.