6 Replies Latest reply on Apr 5, 2013 1:21 PM by philmodjunk

    Script for user lookup

    BryanN

      Title

      Script for user lookup

      Post

           2 part question:

            

           Part 1: Currently running data separation method with all users created/validated by Filemaker (in both the data and UI file).  I'd like to make a Users table to store some basic info: user name, Full name, email, maybe their extension or perhaps in the future, user preferences.  For the time being, I'd like to have a field in my Quotes table autofill with the user's full name.  How can I best achieve this?

            

           Part 2: I will be deploying FM Server in the next couple months and switching over the accounts from FM based to Open Directory based.  How, if at all, will those types of scripts change (the user names will not change between the two platforms)?

            

           Thanks!

        • 1. Re: Script for user lookup
          philmodjunk

               1) what purpose is served by physically copying the user name into a field? You can use a relationship to simply link that record to the correct record in the Users table and then this name is available to display on a layout, use in a calculation or to export to a file.

          • 2. Re: Script for user lookup
            BryanN

                 The idea is that it would autofill the 'salesperson' field in our qutoes with the user's full name.  I don't have any issue with giving them unique IDs in a dedicated table and linking them, but I still want the field to be able to auto fill instead of having to select their name from a drop down.

            • 3. Re: Script for user lookup
              philmodjunk

                   Well I'm being picky, but that's not really "auto-fill". It's just a case of displaying the name of the correct person for the current record--which can be done via a relationship instead of copying the data into a field in the Quotes table.

                   Is this to be the name of the user that first created the record?

                   If so, you can set a text field to auto-enter the user's account name. Then you can link this table to your Users table by account name in order to access their full name. Once you have the relationship in place, you can simply add the name field from the Users table to you Quote layout as though this were another field in your quote table.

                   And if you want to be a bit more cautious, its possible to use the auto-entered account name to trigger a looked up value setting that copies over the ID number from the User table so that you can show the correct name even if the user later changes their account name. This method uses two different relationships between Quotes and Users. One matches by account name to facilitate the lookup of the ID number. The second matches by ID numbers and is used to display the correct full name on your layout.

              • 4. Re: Script for user lookup
                BryanN

                      

                     

                          Well I'm being picky, but that's not really "auto-fill". It's just a case of displaying the name of the correct person for the current record--which can be done via a relationship instead of copying the data into a field in the Quotes table.

                     

                          Is this to be the name of the user that first created the record?

                      

                     It's ok to be picky, ideally, yes, the user who creates the record would have it associated with them.

                      

                     

                          If so, you can set a text field to auto-enter the user's account name. Then you can link this table to your Users table by account name in order to access their full name. Once you have the relationship in place, you can simply add the name field from the Users table to you Quote layout as though this were another field in your quote table.

                      

                     No problem with auto entering the user's account name.  That's an easy one.  So what you are saying is instead of using a serialized PK/FK for the users, I can just use the user name as the PK and the auto-entered user name as the FK for the quote?

                      

                     

                          And if you want to be a bit more cautious, its possible to use the auto-entered account name to trigger a looked up value setting that copies over the ID number from the User table so that you can show the correct name even if the user later changes their account name. This method uses two different relationships between Quotes and Users. One matches by account name to facilitate the lookup of the ID number. The second matches by ID numbers and is used to display the correct full name on your layout.

                      

                     That's good to know.  Since I'll be using OD, I don't think users can changer their user names so that shouldn't be an issue.

                • 5. Re: Script for user lookup
                  BryanN

                       Got it working. Thanks!

                  • 6. Re: Script for user lookup
                    philmodjunk

                         I thought I posted a warning about this:

                         

                              So what you are saying is instead of using a serialized PK/FK for the users, I can just use the user name as the PK and the auto-entered user name as the FK for the quote?

                         In FileMaker, you have UserNames and AccountNames. They are not the same thing. Make sure to use Account names for this and not User names.