AnsweredAssumed Answered

Script Go To Related Record with OR operator?

Question asked by KirinIchiban on Mar 23, 2011
Latest reply on Mar 24, 2011 by KirinIchiban


Script Go To Related Record with OR operator?


Hello, I am pretty much a newbie to FMP, using FMP 11
I kind of figured out the go to related record script...
however, my situation is : I have 3 fields that contain account name in my CustomersTable; CreatedBy (autoenter), CurrentSalesRep (which I assign an account name to a customer), and CurrentUser (a calc field with Get (accountname)).
Right now I have a self join on the relationships graph where CurrentUser in CustomerTable is related to CurrentSalesRep in CustomersTable2 (same table but self joined). When I run the go to related record script, it works fine, and shows shows me all customers assigned with the currently logged in user.
However, when I have my SalesReps accounts create new customers, they are not assigned to an actual account name yet, so CurrentSalesRep is empty, what I really want the go to related record script to do for me is to use both CreatedBy and CurrentSalesRep fields to see if either contain Get (AccountName) as true, and then go to all records that have either CreatedBy as the current account name, or CurrentSalesRep has current account name.
I tried another way with using enter find mode, and set field, but again, I can't seem to add an OR operator to include both fields, or when I try to do the expand found set step in the script, I can't seem to figure it out...

Basically, I have privilege sets for SalesRep accounts and when they log in, I want them to be working from a found set that is related to by either CreatedBy or CurrentSalesRep only, I don't want them to see other SalesReps customers, and I don't want them to have to search through a whole bunch of "no access" records.

Please help. If you can show me a better logic for me to accomplish what I'm asking for then please tell me also.

Thank you