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
Tamojita GuhasarkarTamojita Guhasarkar 

How to make filed read only and copy value from other fields when picklist value is selected

Hello Team ,

Need help to overcome the situation, please help.

I've a custom object that contains customer information like customer name, address etc. I have few other fields on this object named Recipient, Recipient Name, Recipient Address. The recipient is a Picklist field which contains values like "Myself" , "Other" . Now the requirement is 

1> If user select "Myself" , then Recipient Name, Recipient Address should become read only and copy values from customer name, address. 
2> If user selects Other, then he can type Recipient Name, Recipient Address by his choice. 

Can someone guide me to how to achieve this, please ?

Thanks,
TG
Best Answer chosen by Tamojita Guhasarkar
Dayakar.DDayakar.D
Hi TG,
We can not make fields readonly and editable based on condition.
But you can write validation rule to restrict user to don not update address when picklist value is "Myself".
for example: use this condition in your validation Error Condition Formula section 
AND(Myself,
OR(
     ISCHANGED( Recipient Name),
     ISCHANGED( Recipient Address)
   )
)



In Error Message Section provide error msg like "Sorry you can not edit Recipient Name/Address when Recipient value is MyChoice"

Use Processbuilder to copy name and address form customer when picklist value is Myself.
Let me know if it helps you. 

Best Regards,
Dayakar.D