Create from Existing item in vLookup

Forums vLooup for SharePoint Create from Existing item in vLookup

Tagged: ,

Viewing 3 reply threads
  • Author
    • #8688
      Robert Sawyer

      Hi Alexandar,

      First of all, you have a great toolkit!
      I’m excited to investigate your latest feature to allow the creation of an item in the vLookup on the new form!

      My question, do you have the ability to create a new item in the vLookup based upon an item that already listed within the vLookup? i.e Allow the user to select an existing item in the vLookup and create a new item where the columns are automactically copied to the new item. Or, open a dialog box of the items within vLookup and allow the selection of an item from which the columns are copied to a new item?

      I hope this makes sense, please message me if you require more clarity or information?



    • #8779
      Alexander Bautz

      Sorry for the delay in answering. I currently don’t have a ready solution for copying a list item, but basically what you need to do is to use a query to find the values you want to copy, and then add a new item with the data.

      Here is a basic example:

      function copyListItem(itemToCopy){
      	var oRes, viewFields = ["Title","AssignedTo"], data = {};
      	oRes = spjs.utility.getItemByID({"listName":"Tasks","id":itemToCopy,"viewFields":viewFields});
      	if(oRes !== null){
      			if(key !== "ID"){
      				data[key] = val;
      		nRes = spjs.utility.addItem({"listName":"Tasks","data":data});
      			alert("A new item with ID "" was created.");
      		alert("No item found");

      You must know the ID of the item you want to clone – and call the function like this:


      Where 123 is the ID of the list item you want to clone.

      In this function you must insert the FieldInternalNames in the ViewFields array, and change the list display name from “Tasks” to you lists display name or GUID.

      Let me know how this works out.


    • #12694

      Did you get this to work? Can you include an example of your configuration and how you have the user selecting which vLookup item they want to copy?

    • #12729
      Alexander Bautz

      Look at this example:

      Use the same method, but change the function used in the special configuration to “init_copyItems”

      function init_copyItems(a,b){
      	var id = b.get_item("ID");
      	a = "<span style='cursor:pointer;' onclick='copyListItem(\""+id+"\")'>Copy item</span>";
      	return a;

      If the vLookup item should appear in the table you must call the refresh function like this after the copy function has finished (in copyListItem function):


      Hope this helps,

      • #12753

        Perfect,it works flawlessly! Thank you so much!

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