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
Vijayakumar KenchugunduVijayakumar Kenchugundu 

Make Account Name read-only based on Ownership picklist

Hello friends,
I need to make Account Name field on Account page layout read-only for Ownership (picklist value) of Public. Any thoughts how to do this without using VisualForce page customization?

Thanks in advance.
Vijay
AnkaiahAnkaiah (Salesforce Developers) 
Hi Vijaykumar,

We can't able to make required fields as read-only at pagelayout level.
You can achieve this by using validation rule. when Ownership is public then we can restrict the user to modify Account Name.

Validation Rule:
AND(ISPICKVAL(Ownership__c, 'Public'), ISCHANGED(Name))

Error Message: we cant able to modify the Account Name when ownership is public


If this helps, Please mark it as best Answer

Thanks!!
Vijayakumar KenchugunduVijayakumar Kenchugundu
Hi Ankaiah,

Thanks for the workaround solution. Can we make non-required field (suppose Account Site or Website) read-only based on picklist value "Public"?
And I would also like to know is there anyway we can pre-populate Account Name and other fields based on picklist value on Account object (or page layout)?

Vijay
AnkaiahAnkaiah (Salesforce Developers) 
Can we make non-required field (suppose Account Site or Website) read-only based on picklist value "Public"? --> Not possible as per salesforce out of box functionality.
 
is there anyway we can pre-populate Account Name and other fields based on picklist value on Account object (or page layout)? 
Ans: Yes, it can be possible via workflow rule,process builder, Trigger,flow
If(ownership = public){
acc.Name ='xyz';
acc.Phone='123345';
acc.type ='abc';
}
If(ownership = private){
acc.Name ='xyz1';
acc.Phone='123345';
acc.type ='abcd';
}

Note: These actions will perform after saving the Account Record.

Hope i answered your questions.

 
Vijayakumar KenchugunduVijayakumar Kenchugundu
Ankaiah - All these workflow rule,process builder, Trigger,flows only mak othe fields populate during saving record. But my requirement is to pre-populate on UI screen as soon as user picks Public picklist value on Ownership. Any workaround for this?
AnkaiahAnkaiah (Salesforce Developers) 
Hi Vijayakumar,

By using field dependency we can achieve. But in this case other fields also should be picklist.
Apart from this there no work around for the SFDC standard UI. You need to go for customization.

Thank you!!