AnsweredAssumed Answered

Get ( ActiveFieldName ) not re-evaluated in limited privileges

Question asked by Unirisk on Mar 6, 2018
Latest reply on Mar 7, 2018 by Unirisk

Product and version: actually using FileMaker Pro Advanced 16.4.403 (but the same issue appears in FileMaker Pro 16, 15, 14, …)

 

OS and version: OS X 10.12.6 / Windows 10

 

Description: I define a custom set of privileges, where I limit the record editing using the Get ( ActiveFieldName ) function. I.e.: the user can edit the record only if he is editing some specific fields. I can’t just use the “Field Access” setting because I don’t need this behaviour for all the records.

So, I use a rule like this in the limited Edit privilege:

Status = "free" or ( Status = "locked" and Get ( ActiveFieldName ) = "NormalField" )

to let the user edit only the NormalField field when the Status field is set to “locked”, and prevent him to edit other fields (like the SpecialField field in the attached file). This means that if Status field is set to “locked” and the user enters into SpecialField, he gets an error message.

Since here everything works fine, but if the user enters into the NormalField first (which can be edited) and then switches to the SpecialField using the Tab key (so no record commit is performed), it seems like the Get ( ActiveFieldName ) function is not re-evaluated and the user can edit the field that shouldn’t be modifiable. On the contrary, entering first SpecialField and then NormalField, the latter is not modifiable; but as the user clicks outside and then enters back again, he can edit it normally.

 

How to replicate

Create a table with three text fields:

  • Status
  • NormalField
  • SpecialField

Create a new privilege set “Normal user” and then create a new account “user” for it.

Set Records > Custom privileges, select the table name and then set Edit > limited… Enter the following formula:

Status = "free" or ( Status = "locked" and Get ( ActiveFieldName ) = "NormalField" )

Save changes, then create a layout to show table data, log in as “user” and try what described above.

If you open the attached file:

  • log in as admin - admin
  • click the switch account button on the right to log in as "user"
  • try what described above

 

Workaround

Set a script trigger on field enter that performs a commit and goes back to the field, at least for each field in the layout you don’t want to be edited if Status is “locked”. It’s a bit tricky because you have to pay attention not to enter in a trigger loop but, until now, it’s the only solution that came up to my mind.

Attachments

Outcomes