Jump 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 User and NOT Creator

Featured Replies

I want to have users log into database with user id, and they are then presented with their own record which they can edit. My way of doing this is rather convoluted, and I always thought it would be something straightforward using get(accountname). However, get(accountname) returns the account who created the record (which is always done by Admin), and not the user logged on. Is this correct? I attempted a script that checked whether user id matched get(accountname), but always got no match.

So. is there a variation of the get command (or something else) that allows me to find the user logged on and not the user who created the account?

Thanks for any help (using FMP10A).

If you want to have a user log in and navigate to a specific record, then that record must have a value in it that identifies it as "their" record.

Get (AccountName) matched to AccountCreated field works, as you've discovered, if the current logged in user is the one to create the record. In your case, all records are created by account Admin.

So, you need a field in the table, such as AssignedTo, that matches your user. AssignedTo would contain the UserID.

I typically have a Users table. The table has __kP_UserID (primary key) and Name_Last, Name_First, AccountName, PrivSet, email, etc.

In a startup script, I use a routine that finds in Users for Get (AccountName). Now, I'm on the User's record. I have their UserID. I can now go to related record anywhere by using a relationship from Users to AnyTable by UserID.

hth,

Barbara

  • Author

Thanks Barbara, I have it all functioning perfectly now. I did have a solution before which used much of what you suggest, but I had many layers of extra (unnecessary) complex also included.

No more!

Thanks again.

Just be sure that one user cannot see the records of other users, if that is a restriction you want to implement. The system you describe [color:red]does not do that.

Also, maybe take a look at this FM Forums article for additional considerations.

Steven

Create an account or sign in to comment

Important Information

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

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.