Do you use passwords to control access to your database? If so, all authorized users can be given the same privilege set or two.
Then this code can control whether or not the script does anything:
If [ Not IseEmpty ( FilterValues ( List ( "[Full Access]" ; "Manager" ) ; Get ( AccountPrivilegeSetName ) ) ) // User's privilege set permits this ]
Put your current script steps here
The user privilege set names for permitted users are what you put in quotes inside the List function.
Yes passwords are used to access the database but I don't think that is what I'm trying to do. MOST of the database everyone can view, but there are certain sections that only people within that profession can view which is what I'm trying to do here. Everyone can see info to a point...but when say a Psychologist goes to enter staff activity, only other pscyhologists are allowed to view this area. A speech therapist cannot. Which is why on the layout they select the line in the portal which applies to their profession, click the button which runs the script and it takes them to professional info for that record. Several professionals will have information on a record but they do not share it.
You follow me?
Yes I follow you.
It does not change my previous suggestion. All people of a given profession would be given the same privilege set. You then use scripts as well as the privilege set settings to control what they can do and what they can see. You wanted a script to only work for certain users. My script example does exactly that. It keeps anything from happening when the user does not have a privilege set name that is a member of the approved list of privilege set names.
You can also use custom settings inside the privilege set to control which scripts may be executed by users with that privilege set, but this will likely produce an error message: "your access privileges do not allow this" or some such message while the script example I gave simply makes that button unresponsive to mouse clicks when a user that does not have privileges clicks it.
Ok....please forgive me for my ignorance and my total lack of scripts knowledge.
What I did was created a Privilege Set called OT Staff. So when the user selects the portal row which contains OT in the Service field and presses the button I want it to open........I know you understand me, I'm just also trying to drill it into my own head how this works.....
So I added the line you gave above to the beginning of my current script but it's not working. I know it's just that I am applying this wrong because I'm clueless...again...sorry :(
If the privilege set name is "OT Staff" use "OT Staff" NOT "[OT Staff]". "[Full Access]" is the privilege set name returned when a user logs in with a full access acount such as the default "admin" account. Don't see any use for "OT" in your script step unless you created a second privilege set with OT as its name.
You might also: See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for more on how you can use Manage | Security to control access to specific records or groups of records.