3 Replies Latest reply on Sep 24, 2014 1:33 PM by tallanwt

    Create dynamic directory name from form field on Sharepoint

    tallanwt Level 1

      Trying to save pdf file to sharepoint site using URL; but need to create directory (initially) and filename dynamically. After directory created addtn'l files may populate dir, so need to check for directory exists; if so just copy files to dir based on field name. I'm able to save files to hard-coded location only, based on below.

       

      How to check and/or create dynamic directory base don field name?

       

      // folder level JavaScript to allow access to the identity object properties
      trustedIdentity = app.trustedFunction( function (sProperty)
      {
      var iProperty = "";
      app.beginPriv();
      iProperty = identity[sProperty];
      app.endPriv();
      return iProperty;
      });

      // folder level JavaScript to allow Save As population of file name
      mySaveAs = app.trustPropagatorFunction(function(myForm, path)
      {
           app.beginPriv();
           var myForm = event.target;
           return rtn = myForm.saveAs(path);
           app.endPriv();
      });

      myTrustFunct = app.trustedFunction(function(myForm, path)
      {
           app.beginPriv();
          
           var vTest1 = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Test1[0]").rawValue.toString();
           var vTest2 = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Test2[0]").rawValue.toString();
           var vTest3 = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Test3[0]").rawValue.toString();
           var vTest4 = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Test4[0]").rawValue.toString();         
           var vpdf_url=location.href;location.href='http://mysite2010.com/documents

           var vPath = "/vpdf_url/" + vTest1 + Test2  + vTest3 + " .pdf";
                //console.println("vPath: " + vPath);

           var retn = mySaveAs(myForm, vPath);

           app.endPriv();

           return retn;
      });