Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script executed by GetUser fails

Featured Replies

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

 

post-61505-0-73757700-1382675302_thumb.p

Solved by Mr. Scott

Go to solution
  • 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

  • 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 

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

  • Author

Thank you doughemi, Get(Accountname) resolved the issue. As a matter of interest what is the functional difference between Username and AccountName

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.
 
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

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.

  • 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.

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

  • 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.

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.

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.