# Different security on contacts; company and person

**URL:** <https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095>\
**Category:** Developers Forum\
**Created:** [July 5, 2005, 7:44am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095 "2005-07-05T07:44:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tinoruijs](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinoruijs](https://www.dynamicsuser.net/u/tinoruijs)\
**Post date:** [July 5, 2005, 7:44am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/1 "2005-07-05T07:44:27Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [July 5, 2005, 8:49am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/2 "2005-07-05T08:49:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tinoruijs](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinoruijs](https://www.dynamicsuser.net/u/tinoruijs)\
**Post date:** [July 5, 2005, 11:57am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/3 "2005-07-05T11:57:34Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![PeterD](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@PeterD](https://www.dynamicsuser.net/u/PeterD)\
**Post date:** [July 5, 2005, 3:11pm UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/4 "2005-07-05T15:11:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [July 5, 2005, 10:14pm UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/5 "2005-07-05T22:14:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tinoruijs](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinoruijs](https://www.dynamicsuser.net/u/tinoruijs)\
**Post date:** [July 7, 2005, 7:15am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/6 "2005-07-07T07:15:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tinoruijs](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinoruijs](https://www.dynamicsuser.net/u/tinoruijs)\
**Post date:** [July 7, 2005, 8:05am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/7 "2005-07-07T08:05:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tinoruijs](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinoruijs](https://www.dynamicsuser.net/u/tinoruijs)\
**Post date:** [November 1, 2005, 7:16am UTC](https://www.dynamicsuser.net/t/different-security-on-contacts-company-and-person/10095/8 "2005-11-01T07:16:04Z")

</div>

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!
