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
AbAb 

Limiting modification of custom field to the owner of record

Hello,

I have an object like below

Custom_Object_ABC__c (Object name)
CreatedBy
Owner
Custom_field1__c (Type number)

the above object will have many records (record1, record2, etc)

I wantt that the OWNER of record1 can modify or enter in field Custom_field1__c of record1,
similarlly, the OWNER of record2 can enter or modify the number in Custom_field1__c of record2

what are ways i could do it
Thank you for suggestion !
Best Answer chosen by Ab
Fabio PalladinoFabio Palladino
Ok,
in this case you need a simple Validation rule on your custom object like this:

ISCHANGED( Custom_field1__c ) &&  $User.Id  <>  OwnerId 

You can perform this check in the trigger too but the Validation rule way performs the same result.

 

All Answers

Fabio PalladinoFabio Palladino
Hi Sandrine,
I think that the immediate simple way is to configure OWD for your custom object to Read-Only but with this no one user exept owner can modify the record.
Is this your requirement ?

 
AbAb
But this object is already public read/write and we need some way to keep exisiting like this and use some kind of validation rule or trigger to do it
TintuBabuTintuBabu
Hi Sandrine,

In Sharing settings specify OWD for this as Public Read Only.
Deselect Grant Access Using Hierarchies. 
Make sure In profile, View All Modify All permision is not given. However, some users—such as those with the “View All” and “Modify All” object permissions and the “View All Data” and “Modify All Data” system permissions—can still access records they don’t own. 
 
AbAb
Hello,
I am looking for a solution which doent not involve profile changes.
 
Fabio PalladinoFabio Palladino
Ok,
in this case you need a simple Validation rule on your custom object like this:

ISCHANGED( Custom_field1__c ) &&  $User.Id  <>  OwnerId 

You can perform this check in the trigger too but the Validation rule way performs the same result.

 
This was selected as the best answer