Wednesday, February 22, 2017

Alfresco Share - How to remove Comments field and hide the Comment link on Document Details page

The document details page is developed using Surf, use the SurfBug tool to identify the components for the Comments field and Comment  link. The SurfBug tool can activated using the following URL: 

http://localhost:8080/share/page/surfBugStatus

After enabling the SurfBug tool click on the Comment link and Comments field to find out the region-id and source-id for the Comments field and link. We need these values to remove the Comments field and hide the Comment link on document details page.





After getting the region-id and source-id add a Spring Surf extension module that tells Share not to render the Comments field and hide the Comment link.

In the extension module override the default sub-components and add new evaluations for it. The region-id and source-id values that we got from the Surfbug tool should be used to identify the components.

In the sub-component evaluation of Comments field specify a unique id and set render to false. This evaluation will hide the Comments field on document details page.

In the sub-component evaluation of node-header specify a unique id and set showComments property to false. This evaluation will hide the Comment link on document details page.

Set the auto-deploy property of the module to true. Restarting the Alfresco server will automatically deploy this module. An example extension module is shown below:


Restart the server. Login to Alfresco Share and go to the document details page, the Comment link and the Comments field should now be removed from the page.