Notes is a common module used to track ad hoc information within Sugar. Sugar Enterprise customers that use the Customer Self-Service Portal will notice that comments logged in that system appear as Notes within Sugar. So making sure there are not any unread Notes can be important daily task for these users. But how do you know if you have viewed each Note already?
In this post we are going to explore how we can add Read and Unread statuses to the Notes module.
This idea is taken from the Sugar Notifications Module which also comes out of the box with Sugar. Basically we will have a new field type styled with Bootstrap labels. The Notes status field will be highlighted with a green label if it has been read and a red label if it is unread.
This new field will be available for Record, List and Subpanel List views. The status will automatically change to Read when any Sugar user opens and views a Note. Notes created through Customer Self-Service Portal will be marked Unread while those created in Sugar by regular Sugar users will be marked as Read. However, Sugar users will also be provided the option to toggle this status by clicking the viewed status label.
We will also provide mass update functionality to update the status of many selected notes all at once! Whew!
Step 1: Adding a new field for Notes Module
Our first step is to create a new status field for Notes module.
Navigate to Admin > Studio > Notes > Fields
Create a new drop down field with name ‘is_read_c’. Select the list name as ‘notifications_status_dom’. I have set the display label as ‘Status’. But you can change the label as per your wish. Also keep the Mass Update check box checked.
Step 2: Create new Read field type
Our next step is to add a new field type called Read for the Notes module. Our new field is_read_c will use this new field type.
Read Field Controller
Read Field Templates
Below we define detail and list view templates for the new field type.
Step 3: Add Status field to Notes View metadata
Now we will add the status field to Notes module views through extensions. Below steps will explain you how to add the fields to record and list view. You can add the extension file to add the field to subpanels as well.
Step 4: Add display labels for the new field type
Our final step is to define the display label for our new field using Language extension.
Step 5: Run Quick Repair and Rebuild