Chain of commands for form field read only

Hi guru’s
Iam New to D365.
Is it possible to write coc for making some form fileds read only on certain conditions
Regards

Sure, making fields read-only from code is possible. Code called through CoC is no exception.
Get a reference to a data source field and call its allowEdit() method. Set it to false if the field should be readonly and don’t forget to enable it again when needed.
For example:

boolean editable = ...;
myTable_ds.object(MyTable, MyField)).allowEdit(editable);

thank you sir
but can i do it at formfield level ?
for ex i want to make sales price editable only for return order
but there are no methods availbale for salesprice field
regards

Which form and form control do you have in mind?