I’ve been going round in circles with this one and changed things so many times I don’t know if I’m coming or going! So any pointers or help would be very much appreciated.
I am trying to send out a PDF invoice attached to an email. The PDF path and filename is stored in the variable $FileName and the text field ‘Invoice Path’. The path to the invoice files is in 'Invoice' directory on the desktop. They are being created correctly as I can open them up using windows run and the data from the $FileName variable
I’m pretty sure it’s something to do with having to add in filewin: somewhere, as the “Invoice Path” field has the additional forward slash in it but have tried putting filewin in lots of different places with an without quotes but to no avail. If I remove the PCEM_AddAttachment line the email without the attachment is sent to outlook.
As I say any help would be gratefully appreciated.
Filemaker Pro Advanced 10
Outlook Manipulator 220.127.116.11
Set Variable [ $FileName; Value:Get ( DesktopPath ) & "invoices/" & Contact Management::Company & "_" & Shows::Show Name & "_" &
Shows::Invoice Number & "_" & Shows::RefNofk & ".pdf" ]
Set Field [ Shows::Invoice path; $FileName ]
#Create PDF invoice
Save Records as PDF [ File Name: “filewin:$FileName”; Current record ]
#Authenticate: This is required once per FileMaker session.
Perform Script [ “ Authenticate (call at least once per FileMaker session)” ]
#Create New Email
Set Field [ Settings::gResult; PCEM_OpenFolder ( "/Inbox" ) ]
Set Field [ Settings::gNewRecordCallResult; PCEM_NewRecord ( "Mail" ) ]
#Populate Outlook record with data from fields in FileMaker.
Set Field [ Settings::gResult; PCEM_SetFieldData ("To" ; Contact Management::Email ) ]
Set Field [ Settings::gResult; PCEM_SetFieldData ("Subject" ; Shows::Show Name & " - invoice no " & Shows::Invoice Number & "/" &
Shows::RefNofk ) ]
Set Field [ Settings::gResult; PCEM_SetFieldData
("HTML Body" ;
"Invoice attached re " & DayName ( Shows::Show Date ) & " " & Shows::Show Date & Shows::Extra Show
Details & " at " & Shows::Venue ) ]
Set Field [ Settings::gResult; PCEM_AddAttachment( $Filename ; "invoice" ) ]
Set Field [ Shows::outlook ID; PCEM_SaveRecord ]