Creating a prescreen filter

Hi Forum, I want to set a filter so that certain users see only the Customers and Contact thats this Salesperson is supposed to see. In other words if the UserID is Fred and Fred is salesperson 78 then when he opens the Customer of Contact card he only sees Customers or Contacts for salesperson 78.

I have tried using Security Filters but this is causing me no end of problems see forum End User Questions.

Thanks

In the OnOpenForm of the card and the list (and maybe also in other places like some reports), you can put some code:

FILTERGROUP(6); SETFILTER("Salesperson Code",'%1|%2','',GetSalesPersonCode(USERID)); FILTERGROUP(0);

Function GetSalesPersonCode(IcodUserID): RETURN-VALUE : code If the user is a SUPER in current company, EXIT('*'); // meaning he may see all Get the Salesperson code of the user and EXIT("Salesperson Code");

Hi Kriki, thank you for the code, all is now resolved. Many thanks…Paul