Push Multiple items to sharepoint list

Forums vLooup for SharePoint Push Multiple items to sharepoint list

Viewing 7 reply threads
  • Author
    Posts
    • #14179
      Navya Marla
      Participant

      Hi Alex,

      Is it possible to create multiple list items at a time in sharepoint list using DFFS in vlookup screen?
      By default the form needs to expose fields for a single record, but also include an option to add another item without displaying a new page.

      Thanks,
      Navya

    • #14210
      Alexander Bautz
      Keymaster

      Hi,
      I’m not sure I understand what you mean. If you set up a vLookup connection between two lists, you can add as many “children” as you like in one session, but to fill in the NewForm on each child you need to bring up the Child item NewForm and save between each added “child”.

      If you are looking at creating for example a predefined set or “tasks” as children to a list item, this could be done using a few lines of custom code that adds the items programatically.

      Let me know what your requirements are, and I’ll do my best to help you.

      Alexander

    • #14218
      Navya Marla
      Participant

      Hi Alexander,
      Thanks for the quick reply.

      With vlookup user can add as many child records as he want,to do this every time user needs to open the new form and click save, repeat the process…
      In my case user wants to add multiple child records at a time in single new form.
      Is there a simple way we can configure in DFFS lookup to add multipule records in the single save.
      please find the screen shot for more details.

      Thanks,
      Navya

      Attachments:
    • #14233
      Alexander Bautz
      Keymaster

      I’m sorry, but there is no built in support for this at the moment. Is it only one multiline textfield you want to save to each of the child items, or is it a full “new item” with for example “Title”, “Responsible”, “Category” and “Description”?

      Alexander

    • #15027
      Artaker
      Participant

      I think this something I’m looking for right now as well.
      I have an InfoPath form I need to replace – but this form has a repeatable table where the user can add multiple elements in one got.
      I guess this is what is needed here?

      Thanks
      BR,
      Nicole

    • #15258
      Alexander Bautz
      Keymaster

      I’ll see what I can do with the next version, but I don’t have a release date on this yet.

      Alexander

    • #26141
      Anne Maki
      Participant

      Hello,

      I was looking for the same type of solution (ability for user to add multiple items within a single form) and found post in the forum. Has this ability been implemented in the current release?

      Thanks,
      Anne

    • #26145
      Alexander Bautz
      Keymaster

      Hi,
      No, there is no built in function that lets you do this, but it can be done with some custom code – here is an example that adds a new item to a list called “YourChildList” – change this to match your list name or GUID, and change the “Description” field to whatever your field is called.

      The code will write the _vLookupID of the parent to the field _vLookupParentID in the child so you can pull the data back with a normal vLookup field configuration.

      Add this to your Custom JS:

      function addNewLine(){
          var b = [];
          b.push("<div class='newItemWrap'>");
          b.push("<div class='newItemLabel'>Title</div>");
          b.push("<input type='text' class='addNewInput'>");
          b.push("<div class='newItemLabel'>Description</div>");
          b.push("<textarea class='addNewTextarea'></textarea>");
          b.push("</div>");
          jQuery("#addItemsPlaceholder").append(b.join(""));
      }
      
      // Call function on load to add first placeholder
      function dffs_ready(){
          addNewLine();
      }
      
      function saveAllNewItems(){
          var data = {}, vLookupID = getFieldValue("_vLookupID");
          // Add _vLookupParentID
          data._vLookupParentID = vLookupID;
          jQuery(".newItemWrap").each(function(i,cont){
              data.Title = jQuery(cont).find(".addNewInput").val();
              data.Description = jQuery(cont).find(".addNewTextarea").val();
              var res = spjs.utility.addItem({
                  "listName":"YourChildList",
                  "data":data
              });
              if(!res.success){
                  alert(res.errorText);
                  return false;
              }else{
                  jQuery(cont).removeClass("newItemWrap").addClass("newItemAdded").find(":input").attr("disabled",true);
              }
          });
      }

      This to your Custom CSS:

      .newItemLabel{
          font-size:1.3em;
          font-weight:300;
      }
      .newItemWrap{
          padding:10px;
      }
      .addNewInput{
          width:100%;
          box-sizing:border-box;
      }
      .addNewTextarea{
          width:100%;
          height:75px;
          box-sizing:border-box;
      }
      .newItemAdded{
          color:#c5c5c5;
          padding:10px;
          border-left:10px green solid;
      }

      And this in a HTML section in a tab:

      <div id="addItemsPlaceholder"></div>
      <div style="text-align:right"><input type="button" onclick="addNewLine()" value="Add new" /><input type="button" onclick="saveAllNewItems()" value="Save all" /></div>

      Let me know how this works out.

      Alexander

Viewing 7 reply threads
  • You must be logged in to reply to this topic.