Record locking not working on new record.
I'm using FMPro 11 Advanced on a Mac, and opened my database also in FMPro 10 with the same problem.
I tried to institute record level locking using RLA via the Privilege Sets options. It kind of works and kind of doesn't, and its the kind of doesn't that has me befuddled. I basically followed the advice here: http://fmforums.com/forum/showtopic.php?tid/210439
I set up a field "Utility_Lock_n" that is autofilled with the value of "1" (unlocked), and followed all of the suggestions in the above link to prevent this from being modified.
I have a script that runs from a trigger on entry into a container field that toggles Utility_lock_n back and forth. Some other fields are set to show "locked" if the value is 0 and "unlocked" if the value is 1, as well as change the container field to show a locked or unlocked 'lock' icon. It visually behaves like it is supposed to and I can verify that the value or "Utility_Lock_n" indeed changes from 0 to 1 when the container/button is pressed.
Better yet, it works for previously produced records (before the current login session), and I cannot edit the records if they are locked. But if I create a new record, even though everything appears to be happening as it is supposed to, I can edit the fields at will. I can create a second new record, switch tables and layouts, switch records, and then go back to that new record and still edit it even if it is locked and "Utility_Lock_n" is showing that it is set to 0. If I logout or close the file and open it back up, then the 'problem' record behaves as it is supposed to.
There is one more piece of wonkiness. If I create a new record and enter something in it and then lock it, and repeat that three times, I can edit all three records even though they are locked (and even after multiple rounds of locking and unlocking). But if I create a record, enter something, and don't lock it, create another record and enter something and don't lock it, and then create a third record and enter something in it without locking it, I can go back to the first of these new records and lock it, and then the second, and then the third (last) and all will behave properly where I can't edit them if they are locked. But after all of this, any records that have gone wonky during a login session stay wonky until I log out, then they will behave properly.
I almost feel like by explaining the detail, a solution is on the tip of my brain, but I am still befuddled.
Here is my script:
If [HelpDesk::Utility_lock_n =1]
Set Field [HelpDesk::Utility_lock_n; 0]
Else if [HelpDesk::Utility_lock_n =0]
Set Field [HelpDesk::Utility_lock_n; 1]
Commit Records/Requests [No dialog] (have tried this with "skip data entry validation" on and off)
Go to Object [Object name: "xxx"]
Any suggestions before I lose the rest of the fuzz on top of my head?