« New Text for unknown … | Home | MBS Filemaker Plugin,… »

Audit with MBS Plugin and FileMaker Server, works with FileMaker go!

Recently in our FileMaker training day there was an interesting question. If we trigger the plugin function through a script on a server, would that perform the Audit calculations on server? Running it on server would avoid a lot of remote SQL queries and be much better for performance.

So if you like to host database on server and have Audit log being updated from all devices, you can do this steps:

First you create the AuditLog table like usually. You add text fields for FieldName, FieldHash, RecordID, TableName and FieldValue. If you like add more like HostName, FieldOfdValue, Platform, UserName, LayoutName or something from the list in documentation. This table must be in same database.

Next you create two scripts per table to watch. First script calls second script with "Perform Script on Server" script step. This script does not need to wait for the other script to finish.

The second script performs the actual Audit call. For this you only need a script step "Set Variable" with the audit calculation: MBS( "Audit.Changed"; Get(CurrentHostTimestamp); "Projects"). Projects is here the name of the table. You can of course include or exclude fields like normal audit handling. If you like, you can pass some extra details using script parameter and use them in this script to log extra information. For that you can for example pass an extra parameter with "Info|" & Get ( ScriptParameter ) to fill the parameter's value into a field named Info.

To actually get something running, you now define for each layout a trigger which calls the first script. So for the trigger OnRecordCommit you choose the script and FileMaker calls the script. The script than performs the other script on server which does the Audit operation. Performance is great here, even from iPad with FileMaker Go 13. If you like you can also have the script perform when user moves to layout or leaves layout.

Please try it. If it works for you, you should see new audit logs being written from FileMaker Pro, Filemaker Go and WebDirect. In the sample project we log in Info field the answer from Get(SystemPlatform), so we record 4 for web direct, 3 for FileMaker Go and 1 for FileMaker Pro on Mac.

There are differences when doing audit on server. Platform on the server is always ServerScripting. The hostname is of course the name of the server. The user name contains the name of script, the login name and and ID. The host IP and time stamps are of course those from the server, not the client.

A new example project and newer plugin is available tomorrow with the next prerelease.
13 05 14 - 15:10
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.