Editing a list with a form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Editing a list with a form

Last post 04-21-2015 04:32 AM by GuyBoswell. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-16-2015 07:18 AM

    Editing a list with a form

    I can't work out if this is a newbie question or the most advanced thing you can't do in InfoPath.  I am desperately hoping I am just being stupid.

    I want to open a SharePoint list in an InfoPath form then add, amend and delete items and write the result back to update the list.

    I am using InfoPath 2010, SharePoint 2013.  SharePoint is in the cloud - WE CAN NOT PUBLISH ANY FORM THAT USES CODE!

    I have a fairly simple list of finance codes that I use as a look up on various forms.  That bit works fine.

    Allowable values on the list are governed by a fairly elaborate set of rules.  It needs to be maintained by finance staff.  Finance staff understand the finance requirements but not the form requirements.  SharePoint list just isn't pretty enough or sophisticated enough to help them.  I want to give them a form to handhold them through the process of adding, editing and deleting values on the list, making sure they can't enter invalid combinations.  E.g. nominal codes must be unique.

    But before I can even get to the complex rules I first need to be able to open the list in an InfoPath form, edit values and write them back to the list.

    That sounds really basic to me.  But I am making no progress at all.  I can edit an item and write it back.  Or I can add an item.  If I open the form to add a value I can't edit another value and if I open the form to edit a value I can't add another value.

    What I can't do and need to be able to do is open a form with all the list data and add to it, amend it or delete from it and update the list.

    Is this so basic that nobody has bothered describing how to do it and I am just being stupid or is it really difficult?

    Is InfoPath even the right tool for the job?

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

    Re: Editing a list with a form

    Hello Guy,

    Thanks for your question! The method you are describing would be Submitting to a SharePoint List. In this method, the data must be brought into the main data source of your form to be mapped back out. For the scenario you are describing, qRules would be the best method, however it does require the publisher to be a site collection admin.

    Here are a few resources:

    CAML method: http://www.infopathdev.com/forums/p/19259/66870.aspx#66870

    Benefit: Does not require code
    Drawback: Can be hard to debug and configure
    *Note: To copy from the secondary into your main data structure you would need to insert more default rows than the maximum list entries. You could then use cascading logic to set the values.

    qRules SubmitToSharePointList:  http://www.infopathdev.com/blogs/hilary/archive/2012/06/27/qrules-submittosharepointlist-walkthrough-for-v4-2-working-with-existing-data-amp-submitting-a-single-mapping.aspx

     Benefit: Easy to use, does not require blank columns

    Drawback: Requires sandboxing and publisher to be a Site Collection Admin unless using filler form

    Hope that helps!
    Bre

  • 04-17-2015 01:40 AM In reply to

    Re: Editing a list with a form

     Hello Bre,

    Thank you for the help.

    I will look at the CAML method.  As I said before publishing code is just not an option for us.  In a cloud SharePoint we don't have any sand boxing or site administration so any code is not an option.

    You mention using default rows to bring in the data from secondary to main.  Hilary Stoupa gave me a solution for another problem that used that before and it worked great.  BUT!!!  There is a limit of 15 rows.  Try any more calculated defaults than 15 and InfoPath thinks you have gone into a loop and stops.  This list has more than 60 entries so I can't see that is going to work.

    Does the CAML method allow me to delete from a list as well as add or amend items?

    Thanks, Guy

     

  • 04-17-2015 03:16 AM In reply to

    Re: Editing a list with a form

    Nope - don't get it.

    I followed through all the instructions I can see except all those about doing things programmatically - NO CODE!

    Now I have form with a secondary CAML data source and a web service submit.

    The data source includes a field called Name.  If I drag that on to the form I get a repeating section that correctly displays the column headings of my list.

    But how on earth do I get from there to displaying the list items on the form?

  • 04-17-2015 09:53 AM In reply to

    Re: Editing a list with a form

    Hello Guy,

    You'll need a data connection to your list to pull data in, and then the CAML method for New or Update in the method field in the secondary data source. You will also need to make sure you are using the SharePoint ID column to submit and/or update your items.

    Thanks!
    Bre

  • 04-21-2015 02:40 AM In reply to

    Re: Editing a list with a form

    I have created and populated a list.  All the column headings are simple words, no spaces or special characters.

    I have created a secondary data source to the list and dragged it on to the form to make a repeating table which displays OK.  I have included ID but not the other SharePoint standard columns (created, modified, etc).

    My first column is called, "Nominal", on the list and on the form but SharePoint calls it, "Title".  Is that what I should call it in the .xml?  I have tried both without success.

    I have found the GUID for the list, added it to the form, created an .xml file, created a secondary data source from the .xml file.

    I think the XML data source is working OK.  If I drag it on to the form it displays as a two column repeating table.  "Name", is the list column headings and, "Field", is blank.

    I have created the web service submit referring to the GUID and the XML data connection as described in the Blog.

    What do I do next?

    The conversation between RuneLynx and Hilary all seems to be about setting filters on rules.  Because I am in InfoPath 2010 I think the filters are relatively easy.

    What I can't see is any mention of what the rules do.  I assume they are action rules that update fields?  Is that the empty, "Field", on the XML data connection?  Do I just update those and submit using the web service submit?  So when a row is changed it is copied to the empty XML fields and submitted and then if another row is amended the process is repeated?

  • 04-21-2015 04:32 AM In reply to

    Re: Editing a list with a form

     

    Answered my own question :-)

    Set up an action rule on each field of the repeating table from the secondary source that might be changed..

    Each rule has as many clauses as there are columns to update.  Each clause sets "Field" on the CAML data source to equal the appropriate field in the repeating table.

    But then filtering doesn't work even in 2010, you still have to go in and set the filter condition on each action as per Hilary's advice.

    And a final clause to submit using the web service submit and I can update the list to my hearts content.

    All I need to do now is right in the rules that stops the user changing values to inappropriate values and automatically sets some of the values for them behind the scenes.

    You guys on InfoPathDev are the tops!  Thank you so much

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