Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6260 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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.

Posted

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).

Posted

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

Posted

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!

Posted

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.

This topic is 6260 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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