7 Replies Latest reply on May 23, 2012 9:51 AM by Sorbsbuster

    Limiting Layout Views



      Limiting Layout Views




      I have created a sales dashboard type of layout and i'm wanting to copy the layout for every sales team member that we have. The sales dashboard is based on a salesid that each sales member is given when they start.


      I want a layout for sales person A, one for sales person B and so on...so that they can only see their own.

      I was thinking that i could do this by setting a privledge set for each sales member so that they can only access their own layout. Then i"M guessing that i would need a button to take them to their layout? If so, how can i tell a script to get the user login info and take me to the approprate layout?

        • 1. Re: Limiting Layout Views

          That sounds like a lot of work.  Every time you change the layout you'll have to change x layouts.  Every time a sales team member joins you'll have to go into the design of the file and add another layout, another part of the script, etc.

          It would probably be much easier to limit the records each sales person can see via their privilege set, and then effectively let every sales rep see every record (that they are allowed to see) on the dashboard.

          • 2. Re: Limiting Layout Views

            To learn more, see "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a detailed description of how to set this up.

            • 3. Re: Limiting Layout Views


              If i have a record in the database made for each sales member, is there an easy way to limit each user to only seeing their record?

              • 4. Re: Limiting Layout Views

                That's what the section of that help article tells you how to do. If their records are "marked" in some way that enables you to tell which records are "their" records--such as an account name or a UserID number looked up from their User record, you can refer to the value in that field in a "lock" expression when you specify limited access to the table or tables where you need this type of record level access control.

                Say you have a table with these three fields:

                gCurrentUserID  : GlobalNumberField
                UserID              : Serial Number or UUID field
                AccountName     : User's current account name

                Then a start up script can use Get ( AccountName ) to look up the userID for that account and enter it into gCurrentUserID.

                That enables you to use this calculation:

                UserTable::gCurrentUserID = UserIDField

                as your lock expression in Manage | Security.

                When the user or a script performs a find for records, any records they are not permitted to view by this security setting will be automatically omitted from their found set. Thus it's almost always a good idea for your start up script or a script that accesses a particular layout to perform a find so that the user doesn't see a bunch of greyed out "No Access" records on the layout.

                • 5. Re: Limiting Layout Views

                  Would this limit only one user to look at a record in the layout at a time?

                  Since they are records in a layout, can 2 differetn users be looking at their record simotaniously? Or will the startup script step prevent this?

                  If it does prevent it, is there a way around that?

                  • 6. Re: Limiting Layout Views

                    If you need a given record to be accessible by more than one user (doesn't matter if they are looking at it at the same time or not), you'd need to modify this setup so that you can create a list of users permitted to access the record.

                    There's more than one way to do this. The record's table could be linked to a "permissions" table where you have one record for each permitted user or you can put a return separated list of account names or UserID's in a field in the record. Either way, you can use FilterValues to determine if the current user is a member of this list.

                    Not IsEmpty ( FilterValues ( PermissionsListField ; gCurrentUserID ) )


                    Not IsEmpty ( FilterValues ( List ( PermissionsTable::UserID ) ; gCurrentUserID ) )

                    • 7. Re: Limiting Layout Views

                      I think you were trying to limit the records a user sees by creating one layout dedicated to them, and somehow from that layout devising schemes to only let them view the records they are permitted to.  Now I think you are trying to create one layout, but in a table with as many records as you have users, to perform the same function.  You don't have to do that - the privileges tools in FM let you limit what each user can see.  That is what Phil described, and gave the help page link to.