Get ( recordnumber )
Returns the position of the record in the current found set. It is not a unique identifier of the record. Get ( Recordnumber ) will return a different value for the same number simply if you have different records in your found set or sort them into a different order.
What you need to do is capture the value of the record's primary key and send it to the server side script as a script parameter. The server side script can then perform a find for that record and use it as the data source for your email. (I don't believe that a server side script can access the value of a global variable defined on the client machine. You have to think of a server side script as similar to calling across the room to another user and asking them to do a task in filemaker for you, they don't see your found set, variables or global variable values you would have to tell them all of those details--which is why you'd use a script parameter to send that info to the server side script.)
Is there a way to pass a variable from client to server-side?<--- Script parameter. Got it. I'll do some digging.
Thanks for your consistently quick and helpful feedback! I really appreciate it.
Ok, so I have my Script1 edited to:
- Commit Records/Requests
- Perform Script on Server [Wait for completion; "Script2-ServerSide"; Parameter: ProperTableName::docKey]
And my Script2 is edited to:
- Go to Layout ["ProperLayoutName" (ProperTableName)]
- Perform Find[Restore] (where the find request criteria is: ProperTableName::docKey: [== Get (ScriptParameter)]
- Send Mail [Send via SMTP Server; No dialog; To: "firstname.lastname@example.org"; Subject: "New form - " & ProperTableName::Submitter Name & " - " & ProperTableName::Project Name & " - " & ProperTableName::Timestamp]
This returns an empty email... Am I on the right track?
So do it this way:
Enter find mode  ---> clear the pause
Set FIeld [ ProperTableName::DocKey ; "==" & Get ( ScriptParameter ) ]
Perform FInd  ---> note no criteria stored here.
Not only does the "set field method" enable you to use calculations, it leaves all the criteria visible in your script. You don't have to double click and open other dialogs to see what criteria is specified.
For more scripted find examples, see: Scripted Find Examples
Thank you kindly!! Is there a way to get filemaker to compose HTML email?
Take a look at email plug ins. I believe that there are several that can do that. Don't know how/if that'll work "server side"...
Ok. Thanks a ton.