Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Get (ActiveFieldAccess) ... ?

Featured Replies

I have a script that changes the value of a particular field. I would like to start the script with something like "if this user is not allowed to edit this field, then exit the script".

I have seen the "Get(RecordAccess)" function, but not one at the field level. Any tips? thanks in advance.

The user belongs to a Privilege Set, correct? Let's say it is called "StandardPriv." Then, in your script:

If (Get (PrivilegeSetName) < > "StandardPriv",

setfield

End If

Make sure that the checkbox at the bottom of the Script window is not selected for Run with Full Privs.

Whilst checking the privilege set name is good, problems could arise later when more privilege sets are added or modified.

Instead, perform a "practical test" to see whether the field is locked by setting the field to its current value: if an error occurs, you know it's locked. The "Set Error Capture [ On ]" step suppresses the error from being reported to the user.

Set Error Capture [ On ]

Set Field [ field ; field ] // Set field to itself

Set Variable [ $error ; Get( LastError ) ]

Set Error Capture [ Off ]

If( $error = 0 )

Else

End If

If you're using FMP 8 or earlier, put the error into a global field instead of a variable (since variables are FMP 8.5 and later).

But, Vaughan, how is the field locked? In any case, it'll be tied to a priv set, right?

  • Author

Hi bccooney and Vaughan, thanks a lot for your feedback.

bccooney, your solution is good but what I like about Vaughan's is that is dynamic, that is what I was looking for. That is, let's say that I add a new priviledge set, if I use your solution I would need to modify the script, whereas if apply Vaughan's there is no need to adjust the script. Thanks a lot to both anyway!

OK. I give up. How is the field "locked?" You'd still have to set up the access privs for editing this field for the "new" priv set. Also, I prefer my scripts to have "all the info" in the script. So, when the field doesn't edit, I can see it's bcs of the priv set.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.