Autosave and reading URL

Forums General discussion Autosave and reading URL

Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #33123
      Todd Fleming
      Participant

      I have link from each item in one SharePoint list to add the item to the second list. The link from the first list is a calculated field with query string at the end that opens a new item form on the second list. The link ends with /NewForm.aspx?ID=6&Source=http://…

      I would like for the ID number to be saved in the new list in a field called CatalogID, the form to automatically be saved and the user directed to the URL specified in the source value in the URL. This all works with a manual save, but when I add a trigger save function into custom JS, the record saves, but without the value in the CatalogID field. Any thoughts on how to achieve the behavior and allow the URL to be read and value saved? The entire code for custom JS that I am using is:

      var fields = init_fields_v2();
      var yourQueryStringVal = GetUrlKeyValue(“ID”);
      setFieldValue(“CatalogID”,yourQueryStringVal);

      spjs.dffs.triggerSave();

    • #33126
      Alexander Bautz
      Keymaster

      Hi,
      If the field “CatalogID” is a lookup field you must set a delay before saving the item because the setFieldValue function has built in delay for technical reasons.

      Try it like this:

      setFieldValue("CatalogID",GetUrlKeyValue("ID"));
      setTimeout(function(){
        spjs.dffs.triggerSave();
      },2000);

      Alexander

    • #33189
      Todd Fleming
      Participant

      Thanks Alexander! The field is a lookup. That solution worked well. I reduced the delay to 1000 without any issues.

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