According to Role hide the section

Show Fields on the Basis of Security Role of Current User Using Javascript in MS Dynamics CRM



If you want to show/Hide or Lock/Unlock specific field instead of a whole section you can just replace the "ShowHideSectionAccordingToRole" function with the below function :


function ShowHideFieldAccordingToRole()
{

if(CheckCurrentUserRole("CSR Manager"))
{
//Show the Field
Xrm.Page.ui.controls.get("FieldName").setVisible(true);
               //To UnLock the field
              // Xrm.Page.getControl("FieldName").setDisabled(false); 
}
else 
{
//Hide the Field
Xrm.Page.ui.controls.get("FieldName").setVisible(false);
               //To lockLock the field
              // Xrm.Page.getControl("FieldName").setDisabled(true); 
}
}