Troubleshoot Delete Child

Forums vLooup for SharePoint Troubleshoot Delete Child

Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #21354
      Patrice
      Participant

      I have two separate vLookups configured, both working just fine. I have added the [DeleteChild] custom field to both configurations with the custom js to delete the child record. Both functions present the text “Are you sure…” and both delete the child from the lookup list (which is the same list), however, only one of the functions removes the child record from the form the user sees, the other does not remove the record unless another record is added/refreshed. I think everything is identical and both configurations are the same except the vLookup FIN – it must be something simple why the one function removes the deleted child but the other doesn’t – I am stumped.

      Working vLookup configuration:
      FIN: vLookupAssociate
      Custom Field in configuration:
      [DeleteChild] = {“function”:”init_delete_vLookuAssocChild”}
      Action: Show All Records
      Misc: Refresh all vLookup columns on change = not checked

      custom js:
      function init_delete_vLookuAssocChild(a,item){
      return “<span style=’cursor:pointer’ onclick=’doDeleteItem(\””+item.get_item(“ID”)+”\”)’>Delete</span>”;
      }

      function doDeleteItem(id){
      if(confirm(“Are you sure you want to delete this name?”)){
      var dRes = spjs.utility.deleteItem({“listName”:”AccessName”,”id”:id});
      if(dRes.success){
      jQuery(“#vLookupManualRefresh_vLookupAssociate”).click();
      }
      }
      }

      Configuration where Child is not deleted in form:
      FIN: vLookupVendor
      Custom Field in configuration:
      [DeleteChild] = {“function”:”init_delete_vLookuVendorChild”}
      Action: Show All Records
      Misc: Refresh all vLookup columns on change = not checked

      custom js:
      function init_delete_vLookuVendorChild(a,item){
      return “<span style=’cursor:pointer’ onclick=’doDeleteItem(\””+item.get_item(“ID”)+”\”)’>Delete</span>”;
      }

      function doDeleteItem(id){
      if(confirm(“Are you sure you want to delete this name?”)){
      var dRes = spjs.utility.deleteItem({“listName”:”AccessName”,”id”:id});
      if(dRes.success){
      jQuery(“#vLookupManualRefresh_vLookupVendor”).click();
      }
      }
      }

    • #21356
      Alexander Bautz
      Keymaster

      Hi,
      You must have unique function names for the “doDeleteItem” functions – like you have it now, the last function will override the first – resulting in refreshing of the “Vendor” field in both cases.

      Alexander

    • #21363
      Patrice
      Participant

      Thank you, that did it! I changed the reference to the delete function in both instances:
      function doDeleteVendorItem and function doDeleteAssocItem.

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