Template:Plugin Basics

From 360Works Product Documentation Wiki
(Difference between revisions)
Jump to: navigation, search
(Requirements)
m (Error Handling/Reporting)
 
(13 intermediate revisions by one user not shown)
Line 5: Line 5:
 
====Installation====
 
====Installation====
  
To install the plug-in, copy the plug-in to the correct directory:
+
If you unzip the zip archive containing the plug-in files and open the top-level directory, you will find two subdirectories labeled WIN (for Windows) and MAC (for Macintosh). The WIN directory contains two plug-in files, one with a .fmx extension and another with a .fmx64 extension. The file with the .fmx64 extension is only used for FileMaker Server installations, which are explained below. The MAC directory contains a plug-in file with a .fmplugin extension.
 +
 
 +
 
 +
To install the plug-in, copy the plug-in from the WIN or MAC folder to one of the directories listed below. Directory paths are listed relative to the parent directory of the installation home directory of the FileMaker application.
  
  
Line 41: Line 44:
 
====Demo mode and registering the plug-in====
 
====Demo mode and registering the plug-in====
  
Plug-ins will run in a fully featured demo mode until they are registered. While running in demo mode, the product will run for 2 hours every time you launch FileMaker / FileMaker Server / FileMaker Web Publishing Engine until restarted. Enter the license information in FileMaker Preferences, or by using a script and calling <code>CCRegister</code>.
+
Plug-ins will run in a fully featured demo mode until they are registered. While running in demo mode, the plug-in will run for 2 hours at a time. In order to get another two hours of demo time, you must restart FileMaker Pro, FileMaker Server's database server module or FileMaker Server's Web Publishing Engine, depending upon where the plug-in is installed.
 +
 
 +
To register the plug-in in FileMaker Pro, you may either enter the license information in [http://www.filemaker.com/help/html/preferences.26.5.html FileMaker plug-in preferences] or by calling <code>CCRegister</code> inside a script. You must call <code>CCRegister</code> inside a script in order to register the plug-in for use with FileMaker Server.
  
  Set Variable [ $register Value:
+
  Set Variable [ $register; Value: CCRegister ( $licenseKey, $registeredToName) ]
CCRegister ( licenseKey, registeredTo)
+
  
 
'''Returns''': a 1 on success or a 0 on failure.
 
'''Returns''': a 1 on success or a 0 on failure.
Line 50: Line 54:
 
====Error Handling/Reporting====
 
====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 <code>CCSetErrorCapture</code> with a parameter of true. That will suppress the error dialog from appearing to the user.
+
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 <code>CCSetErrorCapture ( true )</code>. This will suppress the displaying of error dialogs.
  
Whether or not you suppress the error dialogs, a plugin function will return the word <code>ERROR</code> 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 <code>CCLastErrror</code> function. For example:
+
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 check the result of each plugin function call to determine if an error occurred. If an error occurs, use the CCLastError function to get a detailed message describing the error. For example:
  
 
<pre>
 
<pre>
 
Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
 
Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
 
If [ $result = "ERROR" ]
 
If [ $result = "ERROR" ]
Show Custom Dialog [ "An error occurred: " & CCLastError ]
+
  Show Custom Dialog [ "An error occurred: " & CCLastError ]
 
End If
 
End If
 
</pre>
 
</pre>
  
If a plug-in is not installed correctly, calls to a plug-in function will return "?"
+
If a plug-in is not installed correctly, all plug-in function calls will return "?"
  
 
=====To check if a transaction succeeded=====
 
=====To check if a transaction succeeded=====
  
The simplest way to check to see if money has changed hands in a payment processing function call is to check the result of the function itself. This is extremely useful when calling <code>CCProcessPayment, CCVoid, CCRefund,</code> and others. The result of the transaction will give a transaction ID or the word ERROR. Using the <code>CCLastError</code> like in the example above will give further information about the error, such as if there is no network connectivity, or the card was declined.  
+
The simplest way to check to see if money has changed hands in a payment processing function call is to check the result of the function itself. This is extremely useful when calling functions such as <code>CCProcessPayment and CCProfileProcessPayment</code>. The result of the transaction will give a transaction ID or the word ERROR. Using the <code>CCLastError</code> like in the example above will give further information about the error, such as if there is no network connectivity, or the card was declined.  
  
 
  Set Variable[$result ; CCProcessPayment(...)]
 
  Set Variable[$result ; CCProcessPayment(...)]

Latest revision as of 10:15, 6 July 2016

Contents

[edit] Requirements

FileMaker 7 or higher, Java Virtual Machine (JVM) 6 or higher, Windows or Mac OS X 10.6. Rosetta on Intel Macs not supported.

[edit] Installation

If you unzip the zip archive containing the plug-in files and open the top-level directory, you will find two subdirectories labeled WIN (for Windows) and MAC (for Macintosh). The WIN directory contains two plug-in files, one with a .fmx extension and another with a .fmx64 extension. The file with the .fmx64 extension is only used for FileMaker Server installations, which are explained below. The MAC directory contains a plug-in file with a .fmplugin extension.


To install the plug-in, copy the plug-in from the WIN or MAC folder to one of the directories listed below. Directory paths are listed relative to the parent directory of the installation home directory of the FileMaker application.


FileMaker Pro

FileMaker Pro XX/Extensions

FileMaker Pro XX Advanced/Extensions


FileMaker Server Web Publishing Engine (applies to the entire Web Publishing Engine prior to FileMaker Server 12.0.2 and to Instant Web Publishing only for FileMaker Server 12.0.2 and later)

FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins (create the Plugins folder if it does not exist)


FileMaker Server Custom Web Publishing (applies only to FileMaker Server 12.0.2 and later)

FileMaker Server/Web Publishing/publishing-engine/cwpc/Plugins (create the Plugins folder if it does not exist)

Note: For 64-bit versions of Windows, be sure to use the 360Works plug-in with a .fmx64 extension


FileMaker Server Scripting Engine (applies to FileMaker Server scheduled scripts)

FileMaker Server/Database Server/Extensions


Note: Using the plug-in with the FileMaker Server Web Publishing Engine or the FileMaker Server Scripting Engine requires an Enterprise plug-in license.

[edit] Uninstalling the plug-in

Uninstall the plug-in by quitting FileMaker Pro or stopping FileMaker Server and removing the plug-in file from the appropriate Extensions or Plugins directory.

[edit] Demo mode and registering the plug-in

Plug-ins will run in a fully featured demo mode until they are registered. While running in demo mode, the plug-in will run for 2 hours at a time. In order to get another two hours of demo time, you must restart FileMaker Pro, FileMaker Server's database server module or FileMaker Server's Web Publishing Engine, depending upon where the plug-in is installed.

To register the plug-in in FileMaker Pro, you may either enter the license information in FileMaker plug-in preferences or by calling CCRegister inside a script. You must call CCRegister inside a script in order to register the plug-in for use with FileMaker Server.

Set Variable [ $register; Value: CCRegister ( $licenseKey, $registeredToName) ]

Returns: a 1 on success or a 0 on failure.

[edit] 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 CCSetErrorCapture ( true ). This will suppress the displaying of error dialogs.

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 check the result of each plugin function call to determine if an error occurred. If an error occurs, use the CCLastError function to get a detailed message describing the error. For example:

Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ]
If [ $result = "ERROR" ]
  Show Custom Dialog [ "An error occurred: " & CCLastError ]
End If

If a plug-in is not installed correctly, all plug-in function calls will return "?"

[edit] To check if a transaction succeeded

The simplest way to check to see if money has changed hands in a payment processing function call is to check the result of the function itself. This is extremely useful when calling functions such as CCProcessPayment and CCProfileProcessPayment. The result of the transaction will give a transaction ID or the word ERROR. Using the CCLastError like in the example above will give further information about the error, such as if there is no network connectivity, or the card was declined.

Set Variable[$result ; CCProcessPayment(...)]
If[$result = "ERROR"]
	#Transaction is unsuccessful. Below is an example of how you might handle the error. 
	Set Field[Transaction::Error Message ; CCLastError]
Else
	#Transaction is successful.
	Set Field[Transaction::Transaction ID ; $result]
End If

More Information

For more information on how to correctly install and work with plug-ins, check out the Plugins 101 documentation.

Personal tools
Namespaces

Variants
Actions
Plug-in Products
Other Products
Navigation
Toolbox