Read up on FileMaker Pro's Get() functions: Get( AccountName ), Get( CurrentDate ), Get( CurrentTime ).
On 21/02/2012, at 6:57 PM, Mdang:
What is the best way to write a script that when entering an employees layout will default to the current user name?
then stamp the date, time and user name to a note field?
Explore the Filemaker Pro Help documentation available in the Help menu, especially all the options under the Get function.
To show the record for the current user do something like this:
Go to Layout['employees']
Enter Find Mode
Set field['User' ; Get(UserName)]
To stamp the date, time and user name
Set Field['Log';'Get(CurrentTimeStamp) & " " & Get(UserName)']
One caution: Get ( UserName ) will pull the workstation, based on the user name that's set in the Preferences. The user can change this. Also, if a user logs in from a different terminal, you'll potentially get a different user name.
I suggest using the user's account name (Get ( AccountName )) rather than Get ( UserName ) for these reasons.
Thank you Malcom, that helped alot