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.

Set Field based on Privilege Set

Featured Replies

probably a simple question...

but what I'd like to know is how to set a field's value based on the Privilege Set that a user is a member of...

For instance, user A is a Member of Privilege Set A..so upon logging in...any new records created automatically set the Location field to A...etc..etc..

Thhnx in advance

Use get ( privilegesetname ) in your auto-enter calculation.

  • Author

Hmm...not sure I understand that.

sorry to be so obtuse.

I have a field in my Db called Location that uses a value list. Denver, New York etc...

I'd like to make it so that when a user logs in that is part of say the Denver privilege set...the Location field automatically gets set to Denver when they create a new record...if they're part of the New York set it gets set to New York.

is get(privilegesetname) a valid function parameter? I'm not familiar with it.

Do you have a users table? If so, use an Open Script that finds the User using Get (accountname) and then publishes their locationID to gLocationID. Btw, I would not use New York, Denver, but rather IDs that come from the Locations table.

In each table, create a LocationIDCreated field that has as an auto-enter calc, gLocationID.

  • Author

uh...I don't have anything quite so complex.

I have no users table or locations table

The users are setup using Filemaker's default Manage Security.

And the locations are in a simple value list at the moment.

You could put a LocationCreated field in each table, auto-enter calc, and a case statement, but that will spread your logic out. For example, if you decided that you want to change the Location that is associated with a privset in new records, you'd have to change every calc field in every table.

This isn't hard. Create a Locations table, LocationID and Location. Use that to create the value list, just showing the second field.

Create a user table. Now you can directly tie Users and Locations with a LocationID in the User table. Also create an AccountName in the User table and enter their accountname. I also include PrivSet, but that's bcs I script Account creation.

In a script that runs on Open, go to a layout based on Users, enter Find mode and set AccountName to Get(accountname). Perform Find. Now you're at the user record, at can set all sorts of values to global fields or $$vars.

  • Author

good lord....I was hoping for something simple like..if user is member of privilege set X set field (location) to X

etc..etc..was thinking it would be as easy as adding some if thens to a startup script?

Alright. Keeping it simple.

Yes, in a startup script, create a section:

If ( Get (PrivilegeSetName) = X

Set $$location, "New York"

elseif ( get (privsetname) = Y

Set $$location, "London"

etc

endif

Then, in each table, you'd have a LocationCreated field with an auto-enter, $$location.

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.