Some of you may know that most iOS apps have a URL scheme. These URL schemes can be accessed anywhere on your iPhone, so long as you can open a URL. For those of you who don’t know what a URL scheme is, let me explain.
For this article, I’m assuming that you have a basic understanding of scripts and calculations within the FileMaker platform.
URL Schemes Explained
A URL scheme is, at the simplest level, a custom URL that allows users to open an app from another app. You can also define specific actions as the user opens the app. Let’s list a few examples.
On an iPhone, this would open the Messages app:
This would open the Flixster app:
This would open the SimpleNote app, and then create a new note:
So URL schemes are a way of opening and performing a function inside another app. So how does this relate to FileMaker Go? Well, using the ‘Open URL’ script step, we can use these URL schemes to perform functions on your iPhone. Used correctly, this can become an incredibly powerful feature. Oh, did I mention that you can pass variables with URL schemes too?
Creating a Blank Text Message with FileMaker Go
So now we have a basic understanding of URL schemes, we can begin to incorporate them into our FileMaker Go system. As mentioned above, we do this by using the ‘Open URL’ script step.
1. Create a script called ‘New Text Message’. Make sure to save it.
2. Add the ‘Open URL’ step to your script.
3. Set the step to ‘With dialog: Off’.
4. Now it’s time to specify the URL. Open up the step and select Specify. This lets you enter a calculation.
5. Now copy this into your calculation:
(You need the quotation marks so that FileMaker recognises the URL as a string, and doesn’t mistake it for a field.)
6. Save the script, create a button and link the script to the button.
7. Open up the app on your iPhone and give it a go. Your phone should open up the Messages app and create a blank text with no phone number.
Congrats! You’ve just used a URL scheme! However, this is just the start; now you can begin to specify the phone number and text message.
Creating a Text Message with Pre-Defined Phone Number and Text Message Body
So we have made a basic URL scheme script, but now we want to take it to the next level and add some pre-defined data. You can either enter this information directly into the script, or you can pull the values from fields in a database. Because I think fields will be the most popular option, I’m going to demo that.
1. Create a new field called ‘Phone Number’; make sure it’s a text field and not a number.
2. Create a new field called ‘Text Body’; this should be a text field too.
3. Open your script and go to your ‘Open URL’ script step.
4. Edit the URL to look like the below.
"sms:/" & Draft Text::Phone Number & "/&body=" & Draft Text::Text Body
(My FileMaker file is called ‘Draft Text’.)
5. Save the script.
6. Enter some values into the fields you’ve created.
7. Tap the button. You should now see something like this. (I used phone number “111” and text body “Hello world!”.)
There you go, now you know how to create a draft text message and populate it with information. All the user needs to do now is hit send.
Interested in creating a text with multiple phone numbers? Download my example solution to see how.
Please leave your comments and questions below! I hope you enjoyed this article. (Also, if you downloaded the example solution and found it useful; please leave your comments below! It really helps!)