3 Replies Latest reply on Jun 13, 2015 5:36 AM by philmodjunk

    attaching pdf to 'send email' script step

    TomPingel

      Title

      attaching pdf to 'send email' script step

      Post

      Here's my problem:

      I have a script with a 'save records as pdf' script step.

      The script then does a 'Send Mail' with the just created pdf as an attachment.

      When the script is run from the Host computer, all is well.

      When I open the file remote and run the script from the remote computer, both the 'save records as pdf' and the 'send mail' return a 0 'last error' (using the script debugger) but I cannot find the pdf on either computer, and the file is not attached to the email message.

      I'm on FM13 Pro/ Pro Advanced.

      Any thoughts?

        • 1. Re: attaching pdf to 'send email' script step
          philmodjunk

          What calculation is used to set the $path variable?

          • 2. Re: attaching pdf to 'send email' script step
            TomPingel

            I suspect that's the problem.

            In 'save records as pdf' it's a simple file reference shown here - no calculation:

            file:dailySchedule.pdf

            The same file path is used for the attachment in the 'send mail' script step.

            I was hoping the pdf file could be created and found in the same directory as the solution file.

            • 3. Re: attaching pdf to 'send email' script step
              philmodjunk

              That is what should happen and when it does, you should get an error if current user permissions do not permit write access, but then there is this statement:

              When I open the file remote and run the script from the remote computer,....

              The "relative path" specified in this context would be to a directory on the host computer, not the client.

              Unless you need to retain this file after the email is sent, I'd use Get ( TemporaryPath ) to compute the file path and use the client computer's temporary folder for this purpose. Files created in the temporary folder are not retained so I don't get a build up of old files cluttering up my hard drive.

              If I needed to retain this file, I'd insert it into a container field set up with external storage after the email has been sent.