function SetFieldDisable()
{
var Empcode = Xrm.Page.getAttribute("new_employeecode").getValue();
if(Empcode != null)
{

Xrm.Page.ui.controls.get("new_employeecode").setDisabled(true);
}
}

SOURCE : JUST2CODE.IN

Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012