Plug-Ins 101

From 360Works Product Documentation Wiki
Revision as of 15:53, 27 August 2015 by Val (Talk | contribs)

Jump to: navigation, search

Contents

Overview

Intended audience

This guide is intended for FileMaker users and developers who are new to using plug-ins with FileMaker Pro and FileMaker Server. It explains concepts that are applicable to all 360Works plug-ins.


What is a plug-in?

A plug-in is a file that can be installed to add new functions to the calculation dialog in FileMaker. In general, plug-ins do NOT add new script steps or change the overall behavior of FileMaker Pro. They do nothing by themselves, they are only useful when installed some place where they can be accessed by FileMaker.


Advantages of Plug-ins over….

Plug-ins are the solutions to specific user needs not available in Filemaker's standard features. By allowing developers to expand the functionality of FileMaker without changing its core structure, plug-ins ensure that FileMaker maintains its broad user group while meeting very specific needs. Without plug-ins, users would need to purchase additional stand-alone software that may not interface with existing FileMaker databases. By utilizing FileMaker's standard functions to perform non-standard tasks, plug-ins help ensure that your information is accessible, organized, and integrated.

Getting Started with Plug-Ins

Plug-in Installation

(FileMaker documentation:[1])

Plug-in Installation File Locations


Note: 360 Works plug-ins require Java in order to run. FileMaker Pro will prompt you on startup to download the appropriate software if it is not found on your computer. But FileMaker Server has no such prompt, and you may be required to manually download a Java Runtime (JRE) if you do not already have one. On Windows, you will need a current version of Java, Oracle downloads. On Mac, you will need the latest Java 6 update from Apple. For Mac OS 10.6, click here. For Mac OS 10.7-10.10, click here, For OS X 10.11, El Capitan click here


Installing your 360Works plug-in is very straightforward, although there are differences between installing on a client machine using FileMaker Pro, a server using FileMaker Server, or on the FileMaker Server Web Publishing Engine.

Client Install

Open the .zip file from your plug-in download. Locate the appropriate plugin for your operating system inside the MAC or WIN folder. Drag the plugin to your FileMaker Extensions Folder.

Server Install

When installing a plug-in on FileMaker Server, follow a similar process. Drag the appropriate extension to FileMaker Server/Database Server/Extensions.

WPE Install

Install plug-ins on the Web Publishing Engine in order to access them from Instant Web Publishing. Installation is similar: drag the appropriate plugin to FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins. If the Plug-ins folder does not exist, create one. NOTE: The Extensions folder is NOT the same as the Plugins folder in this situation.

CWP Install

If you are going to use Custom Web Publishing instead of Instant Web Publishing then install the plugin to FileMaker Server/Web Publishing/publishing-engine/cwpc/Plugins. Again, you may need to create the Plugins folder.

WebDirect Install (FMS 13+)

Install plug-ins for use with WebDirect by dragging the appropriate plugin to FileMaker Server/Web Publishing/publishing-engine/cwpc/Plugins

AutoUpdate

If you have a plug-in that needs to be installed on multiple client machines accessing FileMaker Server, you can use the Auto Update function to streamline the process. For more information on the process, visit fmp7://autoupdate.360works.com/AutoUpdate360Works.

FileMaker 12 Installation Options

New in FileMaker 12, you can install and update plug-ins from container fields. Simple insert the plug-in into a container field, and call the Install Plug-in File script step. This makes it possible to deploy your solution with a plug-in bundled in that installs and registers itself with a script. You can then call the function Get (InstalledFMPlugins) to see the display name, version, and state. This new script step will install plug-ins to:

Windows XP: \Documents and Settings\[User Name]\Local Settings\Application Data\FileMaker\Extensions

Windows Vista / 7: \users\[User Name]\AppData\Local\FileMaker\Extensions


Mac OS: /Users/[User Name]/Library/Application Support/FileMaker/Extensions

Plug-ins found in the old location will continue to work and are overridden by plugins installed in the new location.

Demo copies and Registration

Each 360Works plug-in is available as a demo version that allows users to evaluate a plug-in. These demonstration copies will generally have limitations on their use such as an expiration date, a time-out timer (typically 2 hours), or limited access to functions.

Registering your plug-in gives you full access to the plug-in’s functions. When you purchase a plug-in from 360Works, you will be given a license key to register your product.

Plug-ins need to be registered in the location that they will be used, whether FileMaker Pro, FileMaker Server, and FileMaker Server Web Publishing.

If you are using the plug-in in FileMaker Pro, you can register your plug-in using FileMaker’s menu. Just select FileMaker Preferences > Plug-ins > Select Plug-in > Configure. Enter the registration name and license key in the fields provided. This information is case sensitive, so be sure to copy directly from your confirmation email.

Plugins1013.png


If you are using the plug-in as part of a network, where multiple users will be connecting to your database and accessing the plug-in, or registering the plug-in with FileMaker Server or FileMaker Server Web Publishing, you’ll need to register the plug-in using a script. We recommend putting this in your database startup script, so that the plug-in will always be registered when new users connect to your database.


To create the script, open your database and select Scripts > Manage Scripts. This will launch the scripts manager.


Plugins1015.png






Click “New” in the lower left corner. Name the script in the Script Name Field, then double-click “Set Variable” from the menu on the left. Now click “Specify” in the lower right. This will allow you to define the script’s process. In the Name field, enter $register.


Plugins1017.png


Click the “Specify” button beside the Value field to bring up the Calculation editor. This is where you can access the plug-in features. In the drop-down menu beside “View” in the upper right, select External Functions. The external functions view is where you can access your plug-in’s capabilities.


Plugins1019.png



For this script, double click the pluginRegister( key ; registeredTo ) function, where plugin is the name of your plug-in. This moves the function to the function editor window, where you can replace “key” with your license key and “registeredTo” with the registration name from your invoice. Click OK in the calculation window and OK in the “Set Variable” option window, then click Save when prompted.


Plugins10111.png




You’ve now created a registration script to run on startup when your database loads. This ensures that the plug-in is registered across FileMaker Pro, FileMaker Server, and FileMaker Server Web Publishing, as well as on any client computers who access your database. This is also the process you will use to call other plug-in functions when building your scripts.

Using Plug-ins

Think of plug-ins as the tools you need to build a specific solution within FileMaker. For example, purchasing 360Works’ Plastic plug-in will not give you an out of the box point of sale system. However, using the tools that Plastic provides and using FileMaker’s existing functions will allow you to build your system from the ground up.

Creating Scripts, Calling Functions, and Setting Variables

Scripts are commands that cause FileMaker to perform specific tasks. They can be simple or complex, made of variable script steps. Script steps are generally composed of a Function, which defines the action that the script performs, and Variables, which define the parameters of the action. As plug-ins are used within FileMaker, you can use scripts to control the actions of plugins.

To create a script, open the script manager from the menu bar of your FileMaker database. This opens the script manager, where you can create new scripts or edit existing ones using the buttons in the lower left. These buttons open the script editor, which show all of the steps in a script. On the left is a list of all possible scripts. These scripts define how the script will perform an action. Double clicking any of these will add the step to your script. To further define the function and parameters of the script, select a script step in the editor window, then click the “Specify” button.


Plugins10113.png



This brings you to the Specify Calculation window. On the left will be a list of all functions accessible to FileMaker. These functions provide the actions that your script will perform. To access the Functions associated with Plug-ins, select “External Functions” in the View drop-down. Adding a function to a script step is known as “calling” that function.


The second part of a script step is known as a variable. This tells the script where to perform the function, and gives the authorization to access this location. Variables are set in the parentheses behind the function in the Specify Calculation window.


Plugins10114.png



Entering this information is known as setting a variable. This process will allow you to write a script calling a specific function with set variables.


Error Handling/Reporting

When something unexpected happens, the plug-in will pop up a dialog showing what the error message is. This makes it easy to see what went wrong. However, in some cases, you (the developer) may prefer to show your own message to the user, or possibly not show a message at all. In that case, you can call <<setErrorCaptureFunctionName>> with a parameter of true. That will suppress the error dialog from appearing to the user.

Whether or not you suppress the error dialogs, a plugin function will return the word ERROR if something goes wrong. It's a good idea to put your plugin functions in an 'If' statement so that you don't execute a bunch of script steps after something has gone wrong. If you'd like for your script to get the error message, you can get that by calling the <<lastErrorFunctionName>> function.

Here is an example of basic error reporting:

Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
If [ $result = "ERROR" ]
    Exit Script[ "Error occurred: " & <<lastErrorFunctionName>> ]
Else
    ... do more stuff here ...
End If

Chaining Multiple Functions Together

Since the string "ERROR" evaluates to false when evaluated by FileMaker, and most plugin functions return a 1 when successful, you can chain multiple dependent plugin operations together using the "and" operator. However, in this case the result will be a 1 or a 0, not "ERROR". For example:

// chain multiple calls together
// if any of the functions fail, the calculation will
// short-circuit with a result of <code>false</code>,
// and none of the subsequent function calls will be evaluated.
Set Variable [ $success =
    FirstPluginFunction("x") and
    SecondPluginFunction("y") and
    ThirdPluginFunction("z")
]
If [not $success]
    Show Custom Dialog [ "An error occurred: " & <<lastErrorFunctionName>> ]
End If

Note: the above only works for plugin functions which return 1 on success! Check the documentation for each function used in this manner.

Additional Error Checking - Plugin not installed

If a plugin is not installed correctly, calls to a plugin function will return "?". As part of your startup script, you should check for this occurrence and display a warning accordingly that the plugin needs to be installed. Note: when treated as a boolean true/false value, FileMaker will treat ? as true.

Troubleshooting/Common Plugin Issues

The plugin file is installed in the correct directory, but FileMaker doesn't load it

Be sure the plugin file is not encrypted and not a hidden file. FileMaker will skip loading plugins that are hidden or encrypted.

"?" failed to initialize

This generally means there has been a mismatch with the version of Java you are using.

This section focuses on FileMaker Pro and Pro Advanced, but the same rules apply to Server concerning 32 vs 64 bit. To find out which version of the plugin you should be using, see the table here:
Plugin_installation

Mac

For Mac users, you need the Apple maintained version of Java, available here:
https://support.apple.com/kb/dl1572?locale=en_US

Windows

Pre-FileMaker Pro 14

All version of FileMaker Pro prior to 14 were 32 bit, follow the instructions below for 32-bit FileMaker 14

FileMaker Pro 14

For Windows users, things have gotten a little more complex with the release of FileMaker 14. There is now a 32-bit and a 64-bit version of FileMaker 14.

You need to have the corresponding plugin, and version of Java.

For 32-bit FileMaker Pro 14

360Works Plugin.fmx (the extension is .fmx)
32-bit version of Java, available here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Windows x86 is the one you want

For 64-bit FileMaker Pro 14

360Works Plugin.fmx64 (notice the extension is .fmx64)
64-bit version of Java, available here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Windows x64 is the one you want

Getting Help

Individual Plug-in Support

Many questions about 360Works plug-ins can be answered in one of two places: the plugin documentation or the product support wiki. To access the documentation, you can either view the documentation.html file within the plugin folder, or visit http://www.360works.com/products. Choose your product from the left sidebar, then click the “View Documentation” button.

You can also check our Product Support Wiki for answers to common plugin questions or visit the FMForums 360Works section. If your question doesn’t appear in the forums, create a new post and a support representative will respond.


Plugins10116.png


Contacting 360Works

Sometimes you may have questions that the documentation cannot answer. You can contact 360Works support in a variety of ways. Our office is open 10am – 6pm ET, and you can reach us at 770-234-9293.

You can also email us at any time at plugins@360works.com.


Helping Us Help You

When we provide support it is important for us to have the most accurate information available. To do so, we may ask you for a few items that may be helpful. If possible, please have this information available when contacting 360Works Support.


Product Information

The version and license of the plug-in you are using, the version of FileMaker Pro or FileMaker Server that you are using, and your operating system.


Plugins10118.png


This shows the License Type (Enterprise License) and Version (1.56). Also notice the “Report a bug” button.


Bug Report

If a plug-in is malfunctioning, a bug report is immensely helpful to identify the problem. To generate a report, logout then log back in to FileMaker. Reproduce the issue and immediately go to FileMaker Pro Preferences > Plug-ins. Select the plug-in, click “Configure” then click “Report a Bug”. This will send a bug directly to our support team who will contact you to follow up.


Getting Log Files

Log files help to tell us what is happening when a plug-in malfunctions. If you are asked to provide a log file, you can do so easily by navigating to the correct location based on your operating system and FileMaker version.


If using FileMaker Pro:

OS X: /Users/userName/Library/Logs/360Plugin Logs/360Plugins_XXXXX.log


Windows XP or S2003: C:\Documents and Settings\<userName>\My Documents\360Plugin Logs\360Plugins_XXXXX.log


Windows Vista, 7, or S2008: C:\Users\<userName>\Documents\360Plugin Logs\360Plugins_XXXXX.log


If Using FileMaker Server:

OSX: /Library/FileMaker Server/Logs/360Plugin Logs/360Plugins_XXXXX.log


Windows XP or S2003: C:\Documents and Settings\Default User\My Documents\360Plugin Logs\360Plugins_XXXXX.log


Vista: C:\Users\Default User\Documents\360Plugin Logs\360Plugins_XXXXX.log

Windows 7, S2008: Windows 7/2008R2 (32 bit): C:\Windows\System32\config\systemprofile\360Works Windows 7/2008R2 (64 bit): C:\Windows\SysWoW64\config\systemprofile\360Works

Personal tools
Namespaces

Variants
Actions
Plug-in Products
Other Products
Navigation
Toolbox