October 25, 201312 yr Hi all, I have a simple script to produce escalation notices based on the user and a time since last run but the blasted thing won't execute. What am I doing wrong ? With debugger the script exits at the first If statement when I am logged on as Sid. Â Screenshot of the script is attached Â
October 25, 201312 yr Solution Perhaps "Sid" is your account name used to login, which matches the account setup in FileMaker security (or LDAP/AD)? If so, change the function to Get ( AccountName) instead. - - Scott
October 25, 201312 yr Author Perhaps "Sid" is your account name used to login, which matches the account setup in FileMaker security (or LDAP/AD)? If so, change the function to Get ( AccountName) instead. - - Scott I knew I would be doing something stupid, thank you that was indeed the error
October 25, 201312 yr Your first step's syntax is incorrect. The expression ("Sid" or "Claire") will always resolve to 0, and so you will always exit the script regardless of what Get(Username) resolves to (unless you have a user named "0"). Make your script If[Get(Username) = "Sid" or Get(Username) = "Claire"] //Then insert the rest of your script. //Then add Else Exit Script End If EDIT: or Get(AccountName), as the case may be
October 25, 201312 yr Author Thank you doughemi, Get(Accountname) resolved the issue. As a matter of interest what is the functional difference between Username and AccountName
October 25, 201312 yr Per the FM functions reference: Get(UserName): The name of the FileMaker Pro user, as specified in the General tab of the Preferences dialog box. Get(AccountName): The authenticated account name being used for the active database file. I recommend to my users that they choose "Other:" in the General tab and input their login name to make logging in to the database easier. Otherwise, the default User Name is usually the System Name - the user name setup on your computer (Users & Groups Preference Panel on Mac OS X). - - Scott
October 25, 201312 yr what is the functional difference between Username and AccountName See: http://www.filemaker.com/11help/html/func_ref2.32.83.html#1041385 http://www.filemaker.com/11help/html/func_ref2.32.3.html#1052203 IMHO, you shouldn't be using either. Instead, assign Sid and Claire to a higher privilege set and deny other users access to the script in their privilege set.
October 25, 201312 yr Author See: http://www.filemaker.com/11help/html/func_ref2.32.83.html#1041385 http://www.filemaker.com/11help/html/func_ref2.32.3.html#1052203 IMHO, you shouldn't be using either. Instead, assign Sid and Claire to a higher privilege set and deny other users access to the script in their privilege set. Why is that preferable to just using the account log in credentials to run the script ?
October 25, 201312 yr Because some day Sid will be replaced by Nancy and then you will have to modify this script - and all other scripts and calculations that mention "Sid" by name. Instead of just promoting Nancy to the higher privilege set and let her inherit all the associated privileges automatically.
October 25, 201312 yr Author That makes perfect sense, thank you. So I just change the user privileges for anybody else to not be able to run that particular script.
October 25, 201312 yr FYI: Comment's recommendation is right on. With respect to [FULL ACCESS] privileges, I don't allow a directory group (external authentication) to have such a high level of privileges (per Mr. Blackwell's security recommendations). I have FileMaker-only accounts for FULL ACCESS, but don't have an external "Admin" group. I also use Matt Petrowsky's "developer" custom function to enable developer-only (FULL ACCESS) functionality. This can be obtained from the Starter example file at filemakerstandards.org, or their GitHub repository. - - Scott
October 25, 201312 yr Author I don't allow any user full access privileges full stop. I don't want them accessing layout or definitions under any circumstances. I will look at the Matt Petrowsky file you recommend, what is it's function ? Back to the script it is now not working correctly. If I use the original step; Get ( AccountName ) ≠ "Sid" or "Claire" and I log in as Sid the script executes but not if I log in as Clair. If I change the script to: Get ( AccountName ) ≠ "Sid" or Get ( AccountName ) ≠ "Claire" it doesn't execute and exits at the first If step.
October 25, 201312 yr Get ( AccountName ) ≠ "Sid" or Get ( AccountName ) ≠ "Claire" is always true. You want to use either: Get ( AccountName ) ≠ "Sid" and Get ( AccountName ) ≠ "Claire" or the opposite: Get ( AccountName ) = "Sid" or Get ( AccountName ) = "Claire" as your test.
October 26, 201312 yr Author Thank you comment, now I have found out why it didn't work I can throw it away and move to your excellent suggestion of attaching the script to a privilege set.
Create an account or sign in to comment