+ Start a Discussion
HariniHarini 

How to restrict the user to add or delete records to a child object

I read in some of the sfdc study guides with eamples to recruiting application,  if a position is closed the reviewer should not be able to add or delete a review and this could be done using roll up summary fields.Could anybody please explain how can that be accomplished.

 

Thanks much.

Best Answer chosen by Admin (Salesforce Developers) 
CRM indiaCRM india

Hi,

 

If you just want to restrict user by not adding or deleting the new chield records. Just flip the recordtype of your  master object and on pagelayout remove the add and delete buttons.

 

Thanks

All Answers

CRM indiaCRM india

Hi,

 

If you just want to restrict user by not adding or deleting the new chield records. Just flip the recordtype of your  master object and on pagelayout remove the add and delete buttons.

 

Thanks

This was selected as the best answer
HariniHarini

Thanks for your response.

 

But as far as I understand, if we flip the recordtype and delete the add/delete buttons it will affect even when the status of master record is open. Right?

 

In my case I want to restrict the user from adding or deleting the child records only when the master records status is closed. If the status of the master record is something else other than closed the user can add child records once the status changes he should be restricted.

 

~Thanks

 

ImaghrooriImaghroori

Harini,

 

You can always create a workflow rule that does a field update.

 

 

Don't Forget, the "Record Type" is a field on the record itself. It can be changed as if it were any other picklist.

 

So you can have the worfklow rule look for the status to be "closed" then tell it to update the Record Type with the different page layout. 

 

 

BeeddiskShahBeeddiskShah

If you remove the delete, edit button then the user will be able to delete them using data loader isn't it? How about setting profile level security..

 

but in the case, if the master object is deleted, and child is not... it will be a  mis match isn't it?

VijaySivakumarVijaySivakumar

If this is a Master-Detail relationship, then we can do  as follows.

 

1) Create a Roll up summary field in the master with formula as Count.  Lets call this field as "Review Count"

 

2) Create a Validation rule in Position to check it as follows

 

and (text(Status) = Closed, isChanged(Review Count))

 

then throw an error.