Troubleshooting FileMaker Problems: There's always more to learn
I recently took over development and/or support of a couple of databases. One is a vertical market app for drone operators, the other a Point of Sale/CRM/Inventory solution used in a truck accessories store. These databases were both developed in a very unique way by the same developer, in a system he devised over a long period of time. And it's unlike anything else I have seen in the way of FileMaker development (that's neither good or bad – some parts are great, some not so great, and some could use some updating. I hope to blog more on the style and essence of his methods - there is a lot to discuss, and a lot that would be of help to many developers). But I had an immediate issue to fix: an intermittent problem.
But it is FileMaker, and troubleshooting FileMaker problems is what developers must do, so I jumped right in.
Business is good at the truck accessory store – lots of customers, lots of traffic. The owners wisely chose to integrate Reputation Marketing in their solution (contact me if you want information about this product – it's incredible for improving a firm's online reputation). Here's how it works: At the time of the sale, the system prompts the store employee to ask if they will provide an online review. If the answer is yes, the employee clicks a button and voila, they immediately receive an email or a text with a link. The link allows them to fill out a quick review, rate the service, and submit. If the review is positive (4 or 5 stars out of 5 possible), the review is posted automatically on the store's social media and website. If it's not so good, the owners are notified before it is posted and have an opportunity to deal with the issue before it is posted.
Reputation Marketing works wonders: the stores online reputation rose from below 2.4 to over 4.6 in three months. And since the results are prolific and public, the staff now competes to get the best scores as a matter of pride. Everyone one wins: the store, the staff, and, most importantly, the customers.
This system depends upon a specially constructed URL being sent to a Reputation Marketing URL when an invoice is closed, but not before. Problem: requests for review were being sent out randomly 2-3 times per week. Not good.
An associate of mine worked with the owners to narrow it down: They recorded video of adding contacts, quotes, and invoices, and finally narrowed down the times when it happened: When a new contact was made and a new quotation was generated, the string was sent. Most of the time.
I joined in at that point, and started walking through those process with Script Debugger. Normally, that would be the only tool I'd need. But I needed to know when a request was sent, so I had to monitor the web end point – the place where the request was received at Reputation Marketing. During testing, the contact record and the quotation record were generated and the URL was triggered upon entering the contact layout.
The bad news: it was not triggered by a script command. It just happened when the layout was accessed. I checked for a layout triggered script trigger (on layout enter), but of course there was nothing there – it would have shown up on the script debugger if it had.
I tried entering the layout again and the URL was sent again without any script interaction. So I decided to examine the script for sending the request, even though that script was not being called during the Contact/Quotation creation process. And there was the problem: the URL was being loaded into a WebViewer object automatically via a calculated field. If the calculated field included an email address or a phone number and and first and last name, then the request was valid. With the WebViewer object was on the layout, when the layout was entered, the WebViewer loaded the URL automatically, just like it would load a webpage when the layout was entered.
The solution seemed obvious: Get rid of the WebViewer and use the Insert From URL command. The only problem: I couldn't find the WebViewer on the layout.
So I turned to the new FileMaker 17 Objects tab in an effort to locate the WebViewer. I found the WebViewer object, selected it, and hid everything but the WebViewer. The problem? The layout was empty, or so it seemed. No WebViewer to be seen. I finally found it by selecting all objects on the screen (remember, all objects except theWebViewer were hidden, so selecting all the objects selected just the WebViewer). Then I could see the dimensions of theWebViewer object in the Inspector panel. It turns out the WebViewer was 1 pixel by 1 pixel in size, and located in the top left hand corner, making it essentially invisible.
Insert from URL
The Insert from URL command is made for this situation: Assign a field to hold the URL (which also receives the response), call it in a script. and test the same filed for the result: success or failure. Easy. Unless you don't know that the field you select must be on the layout somewhere. If is it not, you get Error 102. A quick google search found the problem: add the field to layout (in this case, in the scratch area). After adding and rewriting the script a bit, the random problem disappeared.
Keep digging, especially when what you are seeing doesn't seem possible. FileMaker developers pride themselves on doing the impossible, making troubleshooting more difficult. Remember that your favorite search engine is your friend. And when you get stuck for more than 20-30 minutes, get on a forum and ask for help.
A couple of notes
The Insert from URL script step, starting in FileMaker 16, has the option to use a variable instead of a field on the layout. Not at much cleanup, as the variable, if local, disappears when the script ends.
Also, when using the new Objects feature in FileMaker 17, I discovered that you can't easily unhide the other layout objects after hiding them; FileMaker must be restarted and the solution re-opened to show the hidden objects. Hopefully that will be fixed in an upcoming update. UPDATE: There is an eyeball at the top of the Objects tab - click that to unhide hidden objects.
I like challenges that test your ingenuity.