First as Randip said what is the use case? As according to me it's not at all a best practice to make field read only via trigger as it can be handled via profiles etc as James said.
But if it is not making field "Read Only" rather stop the users to update it in some specific case then it make bit sense. And you can do that via trigger by checking applying your condition. IF you condition matches then do not update the field.
First as Randip said what is the use case? As according to me it's not at all a best practice to make field read only via trigger as it can be handled via profiles etc as James said.
But if it is not making field "Read Only" rather stop the users to update it in some specific case then it make bit sense. And you can do that via trigger by checking applying your condition. IF you condition matches then do not update the field.
But if it is not making field "Read Only" rather stop the users to update it in some specific case then it make bit sense. And you can do that via trigger by checking applying your condition. IF you condition matches then do not update the field.
All Answers
But if it is not making field "Read Only" rather stop the users to update it in some specific case then it make bit sense. And you can do that via trigger by checking applying your condition. IF you condition matches then do not update the field.