Unique Account name
Users in my database create an account name. Can someone help me with a script that will kick a user out if they try to create an account name that already exists?
Won't they get an error if they try that? (if, so youmight be able to trap for that error.)
On the other hand, if you set up a script that creates a record with the account name in a table in your database each time a new account is created, your script can compare the account name entered in a global text field against these records to see if that account name already exists. A script can perform a find or you can set up a relationship that matches the global field to the account name in order to check for a pre-existing account with the same name.
An error message does pop up, "This name is already in use. Please provide a unique user name." The problem is that the user can proceed within the record of the original user--a security problem.
My script looks like (where user name is a text calculation):
If [Get (AccountName)=UserNameCalc]
Go to Layout ["User Error Page" (May)]
Go to Layout ["User Password Entry Page" (Password)]
I was thinking of a script like this--but keep in mind that I haven't tested it:
Set Error Capture [on]Create Account [AccountName: YourTable::GlobalAccountNameField ; Password: YourTable::GlobalPasswordField ; PrivilegeSet: "PrivilegeSetname" ]If [ Get ( LastError ) ≠ 0 // error occurred creating account. ] Show Custom Dialog [ "Please use a different account name" }End If
Such a script would need to be run with the "run with full access privileges" setting.
For this, and all your prior responses to my questions, you are a filemaker Sensai.
Retrieving data ...