eljefejb Posted May 2 Posted May 2 Hello, I'm creating a "mailer" file to send HTML emails from FileMaker without the need for a third-party plugin. The idea is that whenever another FM app needs to send an email, it can just ball up some JSON and call the "Send Mail" script from the central mailer file with the JSON as the script parameter. I've read that if the same credential set exists for the logged-in user in both files, opening the secondary file will be transparent. However, if not, the user is presented with a login dialog. Since the "Open File" script step is not supported on WebDirect, I can't just detect if the file is open (via the DatabaseNames function) and have the script log in. Using PSOS still shows the dialog. Is there any way to run a script from another FM file without the user seeing a login dialog and without needing to duplicate user accounts in the second file?
comment Posted May 3 Posted May 3 I am not sure how applicable this is to your situation but the URL scheme allows you to call a script in another file with the credentials passed in the call itself: https://help.claris.com/en/pro-help/content/opening-files-url.html Another option you may consider is the Data API: https://help.claris.com/en/data-api-guide/content/run-a-script.html
eljefejb Posted May 6 Author Posted May 6 Hi comment, The URL call looks like it would do what I want, but I can't seem to make it go. I keep getting Error 5: "Command is invalid (for example, a Set Field script step does not have a calculation specified)" My script step looks like: Insert from URL [With dialog: Off ; Target: $result ; "fmp://my.server.name/HelloTest?script=SayHello" ; Do not automatically encode URL ] I started with my intended final use, and kept simplifying things when it didn't work. I have made a simple file (HelloTest) that uses the Guest account, to eliminate possible hangups with login, etc. I made sure to add the "fmurlscript" extended privilege. The "SayHello" script just shows a custom dialog. I tried using the IP address instead of DNS name of the server, with and without the script parameter, etc. Still only getting Error Code 5. I found a Google result that said Error 5 used to be a problem with the Insert from URL script step, but that it was fixed in FMS 21.1.1. I am running FMS 21.1.1.40, so that shouldn't be a problem. Also, I have several other places where I use Insert from URL to call an API, and they work just fine. Maybe it's the "fmp://" protocol? FMPro is not installed on the server, so maybe that protocol isn't registered and causing it to barf. But it should work when trying to debug locally . . . 🤷♂️
comment Posted May 6 Posted May 6 You cannot use the Insert from URL script step for this because it supports only a limited set of protocols and the fmp:// URL scheme is not among them. You should be able to use the Open URL script step.
eljefejb Posted Friday at 04:39 PM Author Posted Friday at 04:39 PM I did get the fmp:// scheme to work using the Open URL script step. Wasn't even aware of that one. I thought Insert from URL was the only way to use cURL. Turned out not to be the behavior I was after, though. The Data API is just the ticket. Took a bit to get the hang of, but it works! Thank you for your help!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now