1 Reply Latest reply on Mar 7, 2012 10:15 AM by philmodjunk

    Apply user name to a field?



      Apply user name to a field?


      Hi all,

      I'm in the planning stages of a database for workflow.  In the future, I'm wanting to implement a feature as such...

      Once a user selects a certain value in a field (either controlled by drop down or radio buttons...I haven't decided), a script runs that enters their initials into another field (basically for tracking purposes). 

      Would I need a table that references the username login to their initials?  What other fields/features might I need?


      Thanks for the help.

        • 1. Re: Apply user name to a field?

          Careful, There are UserNames and AccountNames. Account names are specified in manage security and are what the user uses to log into the database with a password associated with that security account. UserNames are specified in Preferences and are unique to a given user account on your computer. FileMaker then confuses things a bit by automatically using the user name as the default account name when you open a file set to require passwords for access.

          You may not need your script. In some cases you can set up a text field to automatically enter the account name or the user name each time the record is modified and/or each time the record is created.

          If you need this info entered only when a specific field or group of fields in a given record are modified, then yes, a table of either account or user names with a second field for initials can be set up so that your system can use either Get ( AccountName ) or Get ( UserName ) to look up and enter the desired intials.

          Here's a sample script that uses a table of account names to look up the user's initials:

          Freeze Window
          Go to Layout [AccountNamesTable]
          Enter Find Mode [] //clear the pause check box
          Set Field [AccountNamesTable::Accountname ; Get ( AccountName ) ]
          Set Error Capture [on]
          Perform Find []
          IF [ Get ( FoundCount ) = 0 // no record with this account name was found]
              Go To Layout [original layout]
              Show Custom Dialog ["No record with this account name was found...]
              Set Variable [$initials ; value: AccountNamesTable::Initials]
              Go To Layout [original layout]
              Set Field [YourTable::Initials ; $Initials]
          End If