A client asked how to detect who locks a field or record in FileMaker. Since a recent FileMaker version (16 maybe) the error dialog shows who edits the record, but how to know in a script?
We recently learnt that setting a field of a locked error will return the error 301 and the error detail shows the name of the user with the account name in brackets, e.g. Christian Schmitz (admin).
Here is a test script:
Set Error Capture [ On ]
Set Field [ Contacts::Title ; Contacts::Title ]
# @variable $name
# @variable $error
Set Variable [ $r ; Value: Let ( [ $error = Get(LastError); $name = Get(LastExternalErrorDetail ) ]; "") ]
Show Custom Dialog [ $error ; $name ]
As you see we use Let statement to query LastError and LastExternalErrorDetail in one calculation. Why? Because if you split it in two lines, the Set Variable would clear the error state. If you notice the comments above it, we use those to tell MBS FileMaker Plugin that there are variables declared in the Let statement. Otherwise our variable check would be unhappy.
We hope this tip helps you.