I don't think you need a script. You can control this with Privilege sets. Set it that each user can only see records where the CreatorName (say) = AccountName. That way they will only be able to see their own records, even if they select 'Show All Records'.
I would say that you need both. You need (or want) to script the database so that it finds only their own records, and you need to set up Accounts (unique for each person), and a Privilege Set for these people (this level of access), which has a Records, View restriction as Sorbuster says.
FileMaker will automatically remove no access records from Finds, which is great. But you still want to create a script for the Show All Records command, likely a Menu Set to trap it, or at least hide and lock the Status Area (Toolbar). Because otherwise Show All Records shows them the records, but puts <<no access>> in all the fields. Still safe, but not pretty.
The View restriction slows down list views considerable, as FileMaker has to evaluate the access for each record. But likely not a big deal on a smallish database. I haven't done this on a file for a while, so don't know if it has gotten faster with FileMaker 10.
This sounds a great way to start. Can you run me through how to set up this aspect in a priviledge set. When I enter the Custom Record Priviledges screen and set the 'view' to 'limited' it asks me to Specify Calculation. Each record has an 'Assigned To' field and it is this that I want to use to control the access. I can find the field in the Current Table box but I can't find a Function where I can enter the persons name. Can you help me with this, I'm not great on Calculations.
I am a bit stuck on creating a script that starts as soon as the person logs onto the database. Perhaps I could have a homescreen that the person reaches as soon as they open the database but again I would need to have a script that sent the person to the homescreen.
At the moment when the database is opened it goes to the first contact sheet that they created - not pretty and quite annoying.
I'm really struggling on how to write a script that works as soon as someone enters their Name and Password onto the opening log-in screen.
Enter Find Mode
Setfield ( CreatorName ; Get (Accountname) )
Set ErrorCapture [on]
In File>file Options there is an option to run a script on startup...check that box and select the script above.
Is this what you're after?
I'll typically also put a button on the layout that says "Show All Records" that does NOT show all records, but performs the script above (without the GotoLayout step). That way it shows all records they're allowed to see...not ALL records.
That seems to be what I want but I can't seem to be able to have a look at the Script Maker so I can actually creat my own script. Do you have the script steps please?
There is nothing to the script. It just does a find for *. You need to read up on Accounts and Priv as stated earlier. ( Fille --> Manage )
Thanks for trying to help me.
I've got it to go to the layout I want but how to I write the 'Setfield ( CreatorName ; Get (Accountname) )' I can't find 'CreatorName or AccountName in the calculation box.
Honestly I'm a dummy on this thing.
Browsing through the thread, I didn't see anyone specifically say what it seems we're all assuming you already knew.
Each Record must have a field which contains the name of the person who is allowed to see it.
To do this, make a text field called "CreatorName" and set it to Autoenter a calculation of "Get(AccountName)"
This is the "CreatorName" field that I referenced in my earlier post re: startup script.
This is also the field which must be referenced in Accounts and Privileges as talked to by Sorbs and David.
When you are making the script Setfield, choose this field as the target...the 'Find' at startup is done on this field.
Note that all of the posts on the thread so far are saying essentially the same thing, but using different words in hopes that you'll understand the base concept. Even mr_vodka examples are in line with the same concept. When you have the concept, you'll see that all of the tools start working for you.
Note further that in order to test your work, the field CreatorName must have values in it. You'll have to create multiple accounts and create records from each so that the field gets different Account Names into it.
Right, I see, cheers.
Do I have to set an override or something for the CreatorName field to set the existing records or to change them to another person if someone leaves and I employ someone else.
Never assume I know anything, I'm completely dumb.
As for transferring clients from one employee to another (leaving/rehire, caseload allocation review, whatever)...Yes.
As for entering this data into pre-existing records, make a backup then look into the Replace Field Contents function in the help menus. You can set the CreatorName across found sets fairly easily.
On a given layout (if the CreatorName is even ON the layout, which is doesn't need to be), the field should NOT be enterable in Browse mode (Feild Behavior setting).
If you want to change a couple records, make the field enterable in Browse mode, make the changes, then make it not enterable again.
For big bunches at once, make backups then explore the Find/Replace function.
Ninja, you're a gem!
I'll start on this and keep you posted how I get on.
Thanks for showing me the start up script going to the layout - that was worth it in itself.
Are you in the US of A or UK?
While my profile says somewhat cheekily (is that a word?) "lurking around...watching" or something like that,
I tend to lurk in the the Northeast of the USA...Pennsylvania to be specific.