function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ed055Ed055 

restrict users from adding contact to an account

I have two account record types for e.g. A and B. Account with record type B is a child of Account of record type A. My requirement is such that only couple of users should be allowed to enter new contact under the parent account whose record type is A .
What is the best way to do this ?  There will only be one level of hierarchy  such that  account whose record type is B will not any any child records below it.

Thanks
Hargobind_SinghHargobind_Singh

Hi, am assuming that you have already eplored sharing rules, and your requirement isn't being completed by them ? 

I can think of following:

  1. Create a new custom "new" button for contact, and on this button, call a VF page or write javascript code that can check the profile and then redirect user to contact creation page or an error page
  2. Write a trigger to check and give error ( but this would be after the user has entered values) 


=========

ps: If your problem/question is resolved/answered, please mark your post as 'Solved' so that the community can benefit with resolution of issues. 
 
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Ed055,

Here are the steps to achieve it.

1. Create 2 record types for account  as 'A' and 'B'.
2. Create 2 page layouts (With and Without New Contact Button) ,and assign those to record types.
3. Assign seprate profiles having acess to different   record type to both user groups .

Let us know if it helps.