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
PronowPronow 

How can I make a lookup field read-only?

Hello there,

I have a junction-like object of two lookup fields. Now I want those two fields to be read-only on their page layouts. How can I make it?

I used all ways like Page Layout, Field level security, Profiles, etc.

Please help.

Thanks in advance.
Ashish_SFDCAshish_SFDC
Hi , 


Checkout field level security for that field with the profile of that user by using which u r not able to see that field.
just check visible checkbox in field level security for that profile.

Also see the threads below, 

https://developer.salesforce.com/forums?id=906F00000008lxUIAQ

https://developer.salesforce.com/forums?id=906F00000008rSEIAY


Regards,
Ashish
AgiAgi
Hi,

if you go to your custom object / in the Custom Fields & Relationships section click on Edit next to your lookup field, uncheck the Allow reparenting checkbox,
then these fields wont be editable on your custom object



or you can create a validation rule on the custom object and allow only sys admin to edit these fields,
AND(
$User.ProfileId  <> "sysadminprofileId",
OR(  ISCHANGED(field1),  ISCHANGED(field2)))
Sudeep DubeSudeep Dube
read Only apply to that purticular profile of that field where U want it read only.
Hargobind_SinghHargobind_Singh
Pronow, create this validation rule on your lookup field: 

ISCHANGED( LookupFieldName__c ) 

This would let the user update a value of your field when inserting, but won't allow the user to update the field-value after the record is inserted, and since FLS is profile specific, this might satisfy your requirement 

Akshay DeshmukhAkshay Deshmukh
if you have made field read only from page layout, then log in from other user "other than system admin"

.try to edit that field.