Jump to content

  •  

Photo

emailing a PDF form from FM 9


  • Please log in to reply
32 replies to this topic

#1 MsqedMan  enthusiast

MsqedMan
  • Members
  • 28 posts
  • FM Application:9
  • Time Online: 2h 25m 44s

Posted 20 March 2009 - 11:47 PM

Hello,
I have read back through the answers already given, but I am still having a hard time scripting this simple task.
I am trying to create a PDF document, with the file name being PO:Approval & ".pdf". I am saving that file to a folder on the desktop. In saving the PDF, I can create an email with said file as an attachment, but I have to go back and fill in all the fields of the email.

If I try and use the Send Email script step, I can't figure out how to attach the file I just created. It seems that the "Attach File" parameter is looking for a specific file.

What am I missing here? Since I want to send both Purchase Orders and Requisitions, I would like to be able to script the email subject accordingly.

Thanks for any help,
Tony
  • 0

#2 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 21 March 2009 - 06:09 AM

Here's a demo that sends an Invoice as a pdf. As you'll see, I don't use the attach to email option in the Save as PDF. I also set a variable to the file path and use it in the Save as PDF and the Email Attachment.

You've mentioned that you save the PDFs in a folder on the desktop, so you'll need to adjust the path. You could use Get (TemporaryPath) in place of Get (DesktopPath), so that the pdfs get written to the OS' temporary folder, which is emptied by the OS periodically.

Attached Files


  • 2

#3 MsqedMan  enthusiast

MsqedMan
  • Members
  • 28 posts
  • FM Application:9
  • Time Online: 2h 25m 44s

Posted 21 March 2009 - 11:51 AM

Thank you! It's amazing how a little syntax typing error makes a big difference!

I am amazed at the wealth of information on this forum.

Tony
  • 0

#4 hollyheadhunter  novice

hollyheadhunter
  • Members
  • 80 posts
  • FM Application:12 Advance
  • Platform:Cross Platform
  • Skill Level:Intermediate
  • Time Online: 1d 17h 39m 51s

Posted 01 May 2009 - 08:52 AM

bocoony -
i've also been trying to figure this out for months. thank you so much for the example!
  • 0

#5 Robert Taylor  apprentice

Robert Taylor
  • Members
  • 125 posts
  • LocationCalabasas - California
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Time Online: 3h 16m 33s

Posted 31 August 2009 - 06:00 PM

Hi Bcooney.

So i use this and it saves it to the Documents folder but what is the syntax to save it in an "invoice folder with in the "Documents folder"

Get (DocumentsPath) & "Inv" & INV:;)__kP_INV_ID & ".pdf"

i did try this

Get (DocumentsPath/invoice) & "Inv" & INV::)__kP_INV_ID & ".pdf"

but it did not work.


Thnks

RT
  • 0

#6 IdealData  IdealData

IdealData
  • Members
  • 2,568 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Snow Leopard
  • Time Online: 8d 9h 24m 58s

Posted 01 September 2009 - 01:10 AM

Get (DocumentsPath/invoice) & "Inv" & INV:;)__kP_INV_ID & ".pdf"


Try...

Get (DocumentsPath) & "Invoice/" & "Inv" & INV::)__kP_INV_ID & ".pdf"

Try studying a little about string concatenation and file path references.
  • 0
Ideal Data - Coherent systems for a chaotic world
I'm available for hire, e-mail me

#7 Robert Taylor  apprentice

Robert Taylor
  • Members
  • 125 posts
  • LocationCalabasas - California
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Time Online: 3h 16m 33s

Posted 01 September 2009 - 09:05 AM

thank you so much it works, will read up more about the subject.
  • 0

#8 adamworking  novice

adamworking
  • Members
  • 11 posts
  • FM Application:11
  • :

Posted 12 October 2010 - 02:01 AM

This is a great example file. Is there anyway to have the email attach both the PDF that the "Email INV pdf" script does, and another standard PDF with terms of order, that will not change for each record?

Thanks
Adam
  • 0

#9 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 12 October 2010 - 03:52 AM

Only one attachment is supported with FM. To have more than one attachment or to send html email, you need an email plugin.

Another thought, couldn't the terms of order be in the footer or a trailing grand summary part (ie part of the same PDF)?
  • 0

#10 Matthew R White  novice

Matthew R White
  • Members
  • 97 posts
  • LocationCorona, Ca
  • FM Application:12
  • Platform:Mac OS X Mavericks
  • Skill Level:Intermediate
  • Time Online: 1d 19h 45m 47s

Posted 12 September 2011 - 07:44 AM

I imported this script into my database, ran it and it pulled up my email program, started a new message and just has the file $exportPath attached. What part of the script do I need to change to attach my .pdf file?
Thanks
  • 0

#11 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 12 September 2011 - 02:35 PM

You'd have to change several things. How about posting your script (just print it to pdf or do a screen shot)? Or, post your file (zipped).
  • 0

#12 amberolivieri  newbie

amberolivieri
  • Newbies
  • PipPipPipPip
  • 4 posts
  • FM Application:12
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Novice

Posted 31 March 2013 - 05:50 PM

I have been able to write the script to save my PDF to a variable name, but it won't attach the file to an email.  This is what my script looks like:

 

 Set Variable [$filePath; Value:Foodler::FilePath & ".pdf"]

Save Records as PDF [Restore; No dialog; "$filePath"; Records being browsed]

Sen Mail [Send via E-mail Client; To: DAHSEDmaster::Send statement to:; Subject: "DASHED Statement Attached"; Message: "Your latest statement is attached."; "$filePath"]

 

This script will save the PDF, as requested, pull up the send email window and populate the email address, but there is no PDF file attached...what am I missing?

 

Thanks,


  • 0

#13 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 01 April 2013 - 03:58 AM

You're missing a correct path. Please print your script to PDF and post here. You've typed in your script, but that's not as accurate as the real script. More specifically, what does $filePath equal after the first script step?


  • 0

#14 amberolivieri  newbie

amberolivieri
  • Newbies
  • PipPipPipPip
  • 4 posts
  • FM Application:12
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Novice

Posted 01 April 2013 - 11:23 AM

I've attached the PDF of my script...

 

When I run this, it saves the PDF file into my directory as follows:

 

filemac:/My Book/OAS/Clients/Dash Deliveries LLC/RP PAYOUTS/FM TEST/$filePath

 

$filePath ends up being the name of the file that I've designated as a new field in my db to be the Name & ID & Period Date.

 

Thanks for your help,

AmberAttached File  Script.pdf   33.84KB   61 downloads


  • 0

#15 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 01 April 2013 - 11:48 AM

I think you're getting ahead of yourself. How about simply using setting $filePath to Get (DesktopPath) & "myDoc.pdf" and see if it works? You're trying to store a path in a field..and I cannot tell if the script is in the correct context to grab that field's value. What is the value in Foolder::FilePath? Beware of extra periods in a file name or dashes, especially if you're grabbing a date value.


  • 0

#16 amberolivieri  newbie

amberolivieri
  • Newbies
  • PipPipPipPip
  • 4 posts
  • FM Application:12
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Novice

Posted 01 April 2013 - 01:23 PM

It wouldn't surprise me if I'm getting ahead of myself!  :-)  Basically, since I wanted the PDF file name to contain all the identifying information I needed, I created a text field.  For example, the file name that gets saved to the drive location is Veggie Fun12506__03_04_03_10.pdf  This file name and field is a text calc field of Restaurant Name & Restaurant ID & Period (where Period is a text field as opposed to a date field).

 

I'm just not sure why the script can save the file, but not attach said file to an email.


  • 0

#17 bcooney  consultant

bcooney
  • Moderators
  • 5,703 posts
  • LocationLong Island, NY
  • FM Application:13 Advance
  • FMGo:iPad
  • Platform:Cross Platform
  • Skill Level:Expert
  • Certification:9, 10, 11, 12
  • Membership:TechNet
  • Time Online: 22d 4h 49m 49s

Posted 02 April 2013 - 02:57 PM

I would like $filePath to equal the complete path. It seems to me that your Save Records as PDF is a concatenation of a prefix and $filePath. Is that correct? Also, try the simple path like I use in the demo.


  • 0

#18 amberolivieri  newbie

amberolivieri
  • Newbies
  • PipPipPipPip
  • 4 posts
  • FM Application:12
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Novice

Posted 02 April 2013 - 05:14 PM

HA!  I got it, thank you!  I think I had different paths between my Save as PDF and Send Mail scripts....I love it when a good script comes together!  Thank you so much for your help!


  • 0

#19 Dr. Evil  Got me a marlin!

Dr. Evil
  • Members
  • 313 posts
  • LocationCalifornia, US
  • FM Application:12
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Novice
  • Time Online: 3d 20h 39m 34s

Posted 23 April 2013 - 12:37 PM

Here's a demo that sends an Invoice as a pdf. As you'll see, I don't use the attach to email option in the Save as PDF. I also set a variable to the file path and use it in the Save as PDF and the Email Attachment.

You've mentioned that you save the PDFs in a folder on the desktop, so you'll need to adjust the path. You could use Get (TemporaryPath) in place of Get (DesktopPath), so that the pdfs get written to the OS' temporary folder, which is emptied by the OS periodically.

 

Thanks for the great demo file, has helped a heap!

 

I have a couple questions on customizing this script and would really appreciate some help with...

 

 1) I would like to have .pdf file name include the current date but haveing troubles getting script to accept it, i.e. Get (DesktopPath) & "Inv" & INV::__kP_INV_ID & " & Get (CurrentDate) & ".pdf" NOTE: I would like date formatted as 2013-04-23 w/zeros

 

 2) DesktopPath and TemporaryPath are great and powerful, but I would like to store all emailed .pdf's on our server. My question is not how to set up the path, tho a tip may be helpful here, but to include in the script some sort of parameter check that confirms user is connected to the server and if not connects or notifies. Preferably connects (May just set up PC's to connect to server on start up). But still need to have some sort of error capture.

The problem I'm having is; if User is not connected to the server the script will not properly save file.

 

:thumbsup: Thanks in advance for any help on this!!!


  • 0
Randy Johnson
graphic designer


OriginalRandy.com

#20 doughemi  lifetime learner

doughemi
  • Members
  • 704 posts
  • FM Application:12 Advance
  • Platform:Cross Platform
  • Skill Level:Intermediate
  • Time Online: 88d 17h 23m 30s

Posted 23 April 2013 - 06:08 PM

Get(CurrentDate) will return the date with slashes.  In a URL those are interpreted as directories.  

You need to spell out your date :

$FormatDate = 

Let(

cd = Get(CurrentDate);

Year(cd) & "-" & Right("0" & Month(cd);2) & "-" & Right("0" & Day(cd);2)

)

 

Then your path would be

Get (DesktopPath) & "Inv/" & INV::__kP_INV_ID  & $FormatDate & ".pdf"

 

(assuming that you want the files in a directory on your desktop named "inv")

 

 

I can't help you with your #2.  Sorry.


  • 0

Give the gift of life. Register as an organ donor today!
http://www.organdonor.gov/become.asp





FMForum Advertisers