Different security on contacts; company and person

Hello, A security issue. I want to use different security for the contact table depending on the field type. Type can be company or person. Now we have a role “Contact” and most of the users are members of this role. Role “Contact” contains inserting of the table contact. Everybody is allowed to insert contactpersons (contacts type person), but I want to reduce the number of persons that can insert companies (contacts type company). I think programming is the only solution, but I do not know exactly where to program for the best result. Has anyone experience with this problem or a good idea to solve this problem? Thanks in advance,

Your easiset solution is to use Form level security, and have different forms for entering Contacts and Persons

Hi David, I don’t know exactly what you mean. We now manage our security trough the permissions on tabledata. Will it be possible then, for a person who may only insert contactpersons, to scroll through all the contacts (companies and contactpersons)?

I think what David means is to have a Company and a Person form. But how to make sure the correct form is called from all objects??? Another way? Make the security groups Company and Person. In the OnOpenForm set a filter on the field Type according to the security group(s) the person belongs to.

No I meant exactly what I said. Create two differnt forms, one for company and one for person, then make the appropriate fields editable or not editable on each, set the Company form to filter on COntact type company, and of course populate fields, (same for person), then just use form security to assign who can access which form.

David, Peter, Thanks for your help! However, I was hoping for a solution without splitting up the current contact card… I’ll keep your suggestions in mind and will let you know how I solved the problem.

By the way, I’m still open for other suggestions because I’m not gonna work on it this week. And probably next week neither… Anyone experience with this problem or similar problems? Or aren’t there other tables with the same design as the contact table? So two entities in one table?

Hi,

quote:

I’ll keep your suggestions in mind and will let you know how I solved the problem.

Well, we solved the problem! In the User Setup we made a option-field “Mutate contacts”. It can be “persons” or “company and persons”. In case of “persons” one isn’t allowed to insert contacts, type company. To achieve the above we put some code in the OnInsert-trigger of the table Contact (5050); IF RecUserSetup.GET(USERID) THEN BEGIN CASE RecUserSetup."Mutate contacts" OF RecUserSetup."Muteren relaties"::persons: BEGIN Type := Type::Person; END; END; END; And next in the OnValidate of the field “Type” in the contact-table the following code; IF RecUserSetup.GET(USERID) THEN BEGIN CASE RecUserSetup."Mutate contacts" OF RecUserSetup."Muteren relaties"::persons: BEGIN IF Type <> Type::persons THEN ERROR(TxcErrorNoRightsNewCompany); END; END; END; The solution is not ideal, but it works!