none
How to submit InfoPath form data to multiple SharePoint lists at one time? RRS feed

  • Question

  • Hi,

    I'm looking for a way to submit certain data in InfoPath form to separate SharePoint lists at the same time. I have a form that has two views with many data in them. I want to keep these data in separate SharePoint list besides keeping them in the XML. I know that you can submit to a form library using SharePoint document library data connection, but I'm not sure if you can use several data connections for submitting data to multiple SharePoint lists. Is it only possible to do using code? If yes, can anyone show a sample. I have never coded in InfoPath, though I used C# a lot in .Net.

    Thank you!
    Regards, R.D.M.
    Monday, December 28, 2009 11:15 PM

Answers

  • There's a big difference between submitting to a form library and submitting to a list.  Did you truly mean a "list" or a library?  I'm not sure, because you started off talking about a list, but then you reference the "submit to a SharePoint library" data connection, which cannot be used for lists.  You _can_ have multiple data connections for submitting to multiple places, but there is no option for submitting to lists.  To submit to lists, you have these options outside of the InfoPath built-in features:

    - Workflow that triggers on the form submitted to a form library and then creates or updates list items in as many lists as you want.  This can be done codeless in SPD or with coded workflows
    - Qdabra qRules 2.0 Submit to SharePoint List: http://www.qdabra.com/en/products/qRules.aspx
    - CAML method (not sure if you can set it up for more than one list, though): http://msdn.microsoft.com/en-us/library/cc162745.aspx
    - Custom code of your own.  I have no samples to provide.
    SharePoint Architect || My Blog
    • Marked as answer by rdoe777 Tuesday, December 29, 2009 4:33 PM
    Tuesday, December 29, 2009 2:34 AM

All replies

  • There's a big difference between submitting to a form library and submitting to a list.  Did you truly mean a "list" or a library?  I'm not sure, because you started off talking about a list, but then you reference the "submit to a SharePoint library" data connection, which cannot be used for lists.  You _can_ have multiple data connections for submitting to multiple places, but there is no option for submitting to lists.  To submit to lists, you have these options outside of the InfoPath built-in features:

    - Workflow that triggers on the form submitted to a form library and then creates or updates list items in as many lists as you want.  This can be done codeless in SPD or with coded workflows
    - Qdabra qRules 2.0 Submit to SharePoint List: http://www.qdabra.com/en/products/qRules.aspx
    - CAML method (not sure if you can set it up for more than one list, though): http://msdn.microsoft.com/en-us/library/cc162745.aspx
    - Custom code of your own.  I have no samples to provide.
    SharePoint Architect || My Blog
    • Marked as answer by rdoe777 Tuesday, December 29, 2009 4:33 PM
    Tuesday, December 29, 2009 2:34 AM
  • Clayton, thank you for replying. I meaned submitting to multiple lists, not libraries. The form already submits to its form library, and I wanted to keep some data in separate SharePoint lists.

    From the ways you suggest, I'd rather choose custom code as I believe you can code anything with little limitations. Also, I'm not sure if I easily move SPD workflows from one environment to another, I have never done this before. About CAML, I looked at the process described in the link and it looked comlicated to me. I have data in dozens of controls, including calculated values, in the form that I need to save in separate SharePoint list and I'm not sure I can handle this using CAML. Thanks for the information!


    Regards, R.D.M.
    Tuesday, December 29, 2009 4:33 PM
  • Yeah, SPD workflows in 2007 aren't reusable or transportable, but if you do a whole site backup/restore or export/import, it keeps the workflow in tact.  This works well for a one-time move, but not for subsequent moves.

    Code is going to be very capable but the most complicated.  It will take the most time and have the most cost, both initially and recurring.  Carefully consider your options before going that route.
    SharePoint Architect || My Blog
    Tuesday, December 29, 2009 5:30 PM
  • That is the problem why I would not consider SPD workflows. I need to update them regularly when requirements change. And, I think it is easier to support a coded InforPath form than managed code workflows. The only disadvantage of code in the forms is that it needs to be deployed as admin approved. I think I should find a good example first as I never coded in InfoPath.


    Regards, R.D.M.
    Tuesday, December 29, 2009 5:50 PM
  • That is the problem why I would not consider SPD workflows. I need to update them regularly when requirements change. And, I think it is easier to support a coded InforPath form than managed code workflows. The only disadvantage of code in the forms is that it needs to be deployed as admin approved. I think I should find a good example first as I never coded in InfoPath.

    If you haven't done this before, then I definitely don't consider it the best route.  I assumed that you would hire or employ someone who is already an expert SharePoint/InfoPath developer.  It's not the sort of thing you just go and start tossing code into.  Are you already an expert .NET developer?  If so, then maybe you are capable of doing it after a good bit of time spent learning the specifics.  Otherwise, I'd highly suggest against it.  Also, putting code into the form will not necessarily supplant the need for workflows.  Hopefully, it will, but I'm not sure, because you're still talking about doing custom actions in SharePoint itself, not just in InfoPath.

    A great place to get expert developer help for InfoPath is on InfoPathDev.com.
    SharePoint Architect || My Blog
    Tuesday, December 29, 2009 5:56 PM
  • I have some experience in .Net application development, and I created several web parts for SharePoint using its object model in C#. I think InfoPath is close it with more XML classes. I want to be able to make the form get, save and update data in SharePoint lists in the way I want, with less limitation. Well, I will see if I can handle it. If not, will consider CAML or workflow option.
    Regards, R.D.M.
    Tuesday, December 29, 2009 6:16 PM
  • Sounds like you can do it.  Head over to IPDev and ask some specific questions.  The whole company that runs the site is full of expert InfoPath devs who can guide you.
    SharePoint Architect || My Blog
    Tuesday, December 29, 2009 6:19 PM
  • This is an old thread but I tripped over a codeless method to do this with OOB InfoPath 2010 and SP 2010.  Assuming your main InfoPath form is published to a document library with the promoted fields that you want to see.   Publish your form to a new document library to capture the secondary data fields that you want separated out.

    1. Using the Publishing Wizard do the following:
      1. Go to – File then Publish
      2. Select SharePoint Server “ Publish form to a SharePoint Library”
      3. Enter location of your SharePoint or InfoPath Forms Services Site:  accept the default in this field from the first published event
      4. Next screen, keep the default or change it, Form Library, Site Content Type or Admin Approved
      5. Next screen, What do you want to do?
        1. Create a new form library
        2. Add new document library name and description
      6. Next screen, Remove all promoted fields not applicable to the new library and add all of the ones you want to see data for.
      7. Click Next and Publish
    2. Come back into the form: If you don’t have buttons added directly to the form to submit or update, add them.
      1. Create a new Action rule on the button
        1. Label the rule to keep it straight
        2. Condition, occurs when button clicked
        3. Add action, Submit data
        4. Use data connection to the second library created
      2. Create a second new Action rule on the same button
        1. Label the rule to keep it straight
        2. Condition, occurs when button clicked
        3. Add action, Submit data
        4. Use original data connection to the library
        5. Then you can add another action to close the form or do whatever you need.
    3. Republish the form to both libraries to set the template for both.
      1. File – Publish – SharePoint Server
      2. Select Secondary library from drop down follow the rest of the prompts
      3. Follow step 5a again, select Primary library from drop down, Add back in all of the promoted fields needed for the primary library and follow the prompts.

    DOCUMENT YOUR FORM WELL FOR MAINTENANCE

    Special considerations, your primary library needs a unique ID to reference in your secondary library.

    Your secondary library will need a unique ID that is not related to the primary if you are going to store multiple records for a single primary library reference.  Example: One form, multiple updates.

    Thursday, July 3, 2014 3:00 PM