You set a variable called $name, then you use a variable called $name.pdf in the pdf script step, they are two different variables.
As far as I can see you are trying to add .pdf to the filename in Save Records as PDF script step and you can't do that there.
Change your set variable script step to this calculation instead:
set variable $name to:
Get(TemporaryPath) & Patients::LastName & ".pdf"
Then just use $name as the output file setting in Save Records as PDF.
What Carl said.
And then, instead of using email for the PDF, you can use the $name as the specified email attachment in a Send Mail script step. This is a lot more flexible in what ends up in the email – you can calculate subject and body contents on the fly.
The script becomes something like:
Set Variable [ $name; Value:Get ( TemporaryPath ) & Patients::LastName & ".PDF" ]
Save Records as PDF [ File Name: “$name”; Current record ]
Send Mail [ Send via E-mail Client; To: Patients::Email; Subject: "Your Results"; Message: "Hi " & Patients::FirstName & "¶Please find your results attached.¶Let us know if we can assist further."; Attachment: “$name” ]
Thanks David and Carl
Will give these a go and let you know how it works out.
Thanks guys - this works a treat.