Only See My Events
How Do I Let a User See Only Their Own Records?
You can easily restrict the events a user is able to see. There are two different approaches to doing this, using Filters and using Access Privileges.
Using Filters is the simplest: you can create a new filter for the event's "owner" and then pre-filter the calendar so only events for that owner show up. If this is all you do, however, users will be able to reset the filter to see other events, which may be a good thing.
You can also hard-code a filter into the calendar by intercepting the SQL request our calendar makes when finding events to display: think of this as a filter the users can't change.
Both of these filter methods use the calendar's interface to restrict what shows up: users could still navigate to the event list and search for events, possibly finding events that belong to other users. If that is not acceptable you'd use FileMaker's built in Access Privileges to restrict what a user can see. This technique uses features built into FileMaker and is not specific to our calendar.
The simplest way to restrict what shows up in the calendar is to employ our filters, perhaps pre-filtering the calendar when users launch it. You can learn more about pre-filtering the calendar here: Filters.
Hard-Coding a hidden filter.
Another approach is to intercept the SQL request the calendar performs when looking for records. This is what we think of as a hidden filter. To do this edit the script "Build Filter ( SourceNo )" and locate the comment "Hard code a filter here" toward the beginning of the script. The next set variable script step can be used to insert a SQL where clause that will always run: look at the comments in that SetVariable calc for more info.
Remember, you probably only want this to run for some users, so either include that "userness" in your where clause or use case statements to make a different where clause for each account name.
Using Access Privileges
This is very easly done; you’ll use FileMaker’s built in Access Privileges to create rules as to which records a logged in user can see, which they can edit etc. You can restrict which layouts they can see and even which specific fields they have access to.
If you haven’t worked with FileMaker’s Access Privileges before, take a moment and read the overview in FileMaker's built in help, check out Contents > Protecting databases with accounts and privilege sets > Creating and managing privilege sets > Editing record access privileges.
For more information about limiting which records a user can see, continue to the "Editing record access privileges" page: you're interested in the "Limited" option under number 4.
Tips & Tricks.
The only tricky part here is finding some attribute of the user’s login to tie that login to a record in the calendar’s events table. The items you have at your disposal are Get ( AccountName ) and Get ( PrivilegeSetName ). The privilege set name is probably going to be used for general things like “administrator” or “sales rep” and may be used in FileMaker’s Access Privileges to limit what a user can see or edit. You may, for example, craft access privileges so that sales reps can’t access the admin tabs on the calendar.
So you’ll probably be using Get ( AccountName ) in your access privilege calculations to compare a logged in user with the user linked to an appointment. There are two basic approaches here: