This is the eighth part of articles discussing Project Detail Page enhancements:
- Show/hide a field depending on the value of an internal field on the same page
- Show/hide a field depending on the value of an Enterprise Custom field on the same page
- Show/Hide a field based on the value of an internal field using REST
- Show/Hide a field based on the value of an Enterprise Custom Field without Lookup Table using REST
- Remove Time from Enterprise Custom Fields on Project Detail Pages
- Remove Prefix from Enterprise Custom Fields on Project Detail Pages
- Hide Impact Ratings on Project Detail Page "Strategic Impact"
- Disable “Project Owner” Button on Project Detail Page
In common scenarios, project managers are allowed to edit some projects not owned by themselves. With allowing this, they are also able to change the owner of a project to any other project manager, what may not be the indented behavior. As an administrator, you can disable the Owner button to prevent them from changing. In the following sample, the button will be disabled for everyone, except the current project owner and members of the group “Web Administrators (Project Web App Synchronized)”. In this SharePoint group, you will find all members of default Project Server group “Administrators”.
If you are working in an on premise environment, you will need to catch active delegate sessions, see “This part is only necessary with On Premise”. In Project Online, you can remove this part.
Copy above code into a text editor, modify at least the marked sections, save with file extension "js" or "html", and upload to your script library.