2 Replies Latest reply on Jul 10, 2012 11:17 AM by StevenDayton

    Trouble with opening an attachment with JS

    StevenDayton Level 1

      Here is the code that is causing me fits.


      var myN = this.documentFileName;

      var myLang = myN.split("_");


      The line below is giving me an error when I execute it by pressing a button.


      this.exportDataObject({ cName: "Page5_Feb_spinner_" + myLang[1] + ".pdf", nLaunch: 2 });


      Here is the error message.


      TypeError: Invalid argument type.

      Doc.exportDataObject:4:Field Button1:Mouse Up

      ===> Parameter cName.


      The first two lines of the script get the name of the file which is "08994_eng.pdf" and split it up so it can get the eng part of the file name.


      If I hard code the name of the file that is attached to the PDF that is supposed to be opened then the line of code below works just fine.

      this.exportDataObject({ cName: "Page5_Feb_spinner_eng.pdf", nLaunch: 2 });


      I have used this method of concatenating various elements into one line before but am not sure why it isn't working in this instance.