I may be misunderstanding your problem but it sounds like you are trying to "bypass" FMP security, which I have found is very well done in FMP.
However, doing this for the "Salesperson" privilege set shows a lot of <No Access> records (which I'm trying to avoid).
You need to rethink your Salesperson securiity locks, or i dont understand your problem.
Hi Jim, I must have done a poor job of explaining myself. I'm not trying to bypass FMP security to show the detail in those <no access> records, rather I'm trying to adjust the found set such that those <no access> records are exlcuded. Performing a find such as _pk_contactID=* successfully does this, but doing so changes the focus from the record selected from my previous find to the first record in the found set. For reference, this is the script I'm running:
Set Variable [ $ConID; Value:Contact Search::_pk_contact_id ]
Close Window [ Current Window ]
Go to Layout [ “Contacts” (Contact) ]
Enter Find Mode [ ]
Set Field [ Contact::_pk_contact_id; $ConID ]
Perform Find [ ]
Extend Found Set [ Specified Find Requests: Find Records; Criteria: Contact::_pk_contact_id: “=*” ] [ Restore ]
I think I understand. You want to find, for the "Salesperson", all of his availble contacts and avoid a found set that includes <no access>.
Change your Find Criteria to include the field that identifies your Salesperson first. then let that Salesperson select form his own private list, there is no need to extend. The <no access> should be avoided if your Security "lock" field works.
If you must find the _pk_contact_id first, then also add [Set Field] the Salesperson ID before the Perform Find, thus making a AND type search.
Thanks Jim. Unfortunately doing so still restricts the found set to the contact record selected in my search layout. I was hoping to simply go to that contact record in the found set of all contacts for that user. This may not be possible, though, and I should stick to a more traditional search and "show all records" button that the user can go back and forth between. I was hoping to avoid having to explain what found sets are to each user as he/she is added.
What field in contacts determines that these records will be accessible for a given user?
Seems like you should use that field via a relationship so that GTRR will work for you in a significantly simpler script.
Using your current script. If you stored the PK in a variable, your script could loop through the records after the Extend Found set, exiting the loop when the current record's PK matches the value in the variable.
I must be me, because it should be easy to do this....
However, the behavior I'm trying to achieve is simply go to the selected record in the found set that contains all records created by that user.
Don' use your script as you show, but go directly to the Contacts made by the USER. Phil points outs the GTRR way with a relationship and ask you what field determines the USER who created the record.
A simple find by that USER identifier field... lets call it SalesPersonID and his/her Privilege Set for purpose of discussion. On a layout using the contacts table info, doing a Find on SalesPersonID will find all of his records.
If you do Phil's new relationship using SalesPersonID Then no Find is needed since the found set will be exclusively his/hers.