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
HuluSFAdminHuluSFAdmin 

Locking Records and their children to make them READ ONLY

I have a object called Insertion Order which have child objects Flights. The Flights have a Look Up relationship to the Insertion Order object.

 

I want to lock down the Insertion Order object and it's children Flights when it is reviewed by the finance team. I set up an approval process and change the Insertion Order object's record type to "Reviewed". I also changed the RecordType of the Flight to "Reviewed" also.

 

The issue is how do I remove the "Edit","Delete" links from the related list  of Flights which show up on the Insertion Order?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
kminevkminev

No unfortunately you do not have a work-around. What I did is I added a pick list and also custom field validators to prevent users from editing record.

 

 

All Answers

MATTYBMEMATTYBME
Have you tried doing this at the Profile level? You should have Custom Object Permissions on all Profiles where you are able to change the Basic Access for Read, Create, Edit and Delete.
HuluSFAdminHuluSFAdmin

If I do it at the Profile level it will lock down ALL the records. I only want to lock down the "Reviewed" record from edited by the Sales Team. That is why I choose the Approval/Record Type path.

 

The only klugy way of doing this is using Validation Rules that prevent the record from being edited if is reviewed and user has a specific role.

   If(Record Type = REVIEWED && UserRole = Sales) then Lock it down.

MATTYBMEMATTYBME
Apologies without seeing your approval process I am possibly shooting in the dark but I thought the whole point of Approval processes were to lock records from being edited. Or are you wanting the record to be locked after the approval process is complete?
HuluSFAdminHuluSFAdmin
My issue is only with child objects that show up in the Related List. I can lock the Insertion Order which is the parent object but I want to disable editing of the children objects that show up in the Related Lists.
jrotensteinjrotenstein

You might be able to handle the record-locking via the Approval process. However, an alternative is to consider using the Sharing Model to control access to records.

 

You could set the default Sharing for your Insertion Order object to Public Read-Only. This means that anyone can view the record, but only the owner (or their superiors in a hierarchy) can edit the object.

 

You can even get a little clever by allowing the object to be Read/Write to everyone while set to a particular Owner (by setting Sharing Rules), but when it is owned by anyone else it is only editable by that specific owner.

 

Clever, eh?!

kminevkminev

Can't you just handle locking and unlocking the object by setting them from the profile level like: Modify All = false and when I records is locked from the approvla processed people with the profile with limited functionality cannot edit, however when object is

approved and therefore unlocked people with profile modify all set to false can still edit the object

RatherGeekyRatherGeeky
Did you settle on a solution for this? Care to share?
kminevkminev

No unfortunately you do not have a work-around. What I did is I added a pick list and also custom field validators to prevent users from editing record.

 

 

This was selected as the best answer