Select a Form In any entity > open Form Then go to Form properties

Click Add in Form Libraries

Select web resource or Create New by clicking New

Enter Code in the Text Editor

Code to Enter in the Web Resource

function ReadOnly ()

{

 var cs = Xrm.Page.ui.controls.get();

 for (var i in cs)

 {

  var c = cs[i];

  if (c.getName() != “” && c.getName() != null)

  {

   if (!c.getDisabled()) {c.setDisabled(true);}

  }

 }

}

Add it in the Event Handlers also

After Click Save and Publish the App

Enter Data Click Save to see its working or not

After Entering Data in Fields and save it then we can see all Fields are Locked, Now this saved form is read only