3 Replies Latest reply on Sep 23, 2013 7:05 AM by taylorsharpe

    Custom Login Script

    1ngconsulting

      I have created a custom Login script for a FileMaker Pro 12 database (primarily utilized by iPads running FileMaker Go 12) that is hosted on FileMaker Server 12 and am having problems when more than one person attempts to login at the same time.

       

      FileMaker locks the record while someone is running the login script, but when they are finished logging in and a second person is waiting to login, the server retains the custom dialog input field contents instead of clearing the contents (as the script instructs the system to do). This is completely an issue of timing. If one person logs in completely before another individual attempts to login, everything works beautifully.

       

      I'm curious if someone with more experience than me could offer valuable advice as to an alternative method, or a way to prevent the error from occurring.

       

      Originally, my plan was to use the 'relogin' command, but this uses the identity of the device being used, rather than the username and password that has been loaded into the program under security.

       

      Any help would be welcome.

       

      Thanks,

        • 1. Re: Custom Login Script
          BruceHerbach

          Please post your script so we can see what is going on and possibly offer some advice

          • 2. Re: Custom Login Script
            thirdsun

            I can't tell if this is an option for you, but you might consider using global fields, which are unique to each user - this way users shouldn't see field content from other users. The better approach would be a Session table though:

             

            I use a custom login script as well - I have a dedicated Session Table for that purpose. Basically during login the script checks if there is an open session for that user and if so that record is used. Otherwise a new session is created. When the file is closed another script closes all open sessions of the current user (there should only be one anyway) . The same thing happens if the user explicitly logs out. The open/closed option is just a number field flagged with 1 or 0 (true/false).

             

            That way I can see all logins and logouts with date, time, client and so on. Due to the fact that every user has their own session records, locking isn't an issue.

            • 3. Re: Custom Login Script
              taylorsharpe

              I agree with thirdsun... use global fields and/or global variables.  Make sure your login script is only reading data or creating new records to avoid record locking.  Or adapt your script to figure out what it needs to do if it wants to modify a record that is already record locked.