Here is a guest post from Hatim Alam from BHEA, an Elite SugarCRM Partner, and is a certified Sugar Developer Specialist. Hatim shares some ideas for getting creative use out of Sugar Notifications. Share your own ideas in comments below!
In this post, we are going to look into different scenarios where Sugar Notifications can be of great help. For example, It can be used to notify user when new post or comment has been created on the Activity Stream or on execution of custom job or on triggering of API endpoint or implementing approval/review workflow.
We will create Sugar Notification for each of these scenarios and learn how easy it is to use and implement.
What are Sugar Notifications?
The Notifications indicator is available to all Sugar users and is located on the upper right of the screen next to global search.
The number displayed in the notifications box indicates the number of messages with a status of “Unread”. A “0” will appear if there are no unread notifications.
Open the Notifications dropdown and click “View Notifications” in order to see all notifications in a list view.
Create Sugar Notifications on new posts or comments in the Activity Stream
Editor’s Note: Pedro Bazan had published popular a logic hook for adding notifications whenever a user is mentioned in an Activity Stream.
The following steps will create new before_save logic hook on Activities bean within Activity Stream module. Through this logic hook, we will create a new notification whenever a user posts a new comment.
Step 1: Create before_save Logic Hook extension definition
Step 2: Create the Logic Hook action method
As defined in our logic hook extension above, now we need to create a file where we can define our logic hook function. In this action, we will check if any new post or comment has been posted to Activity Stream.
Usually, there are multiple types of activities in Activity Stream – link, unlink, create, update and post. We will be checking if the activity type is a post. The post activity type is associated with new posts or comments within an Activity Stream.
Create Sugar Notifications to update status of data synchronization
We have many situations where we integrate Sugar with external applications and expose our custom APIs to update data in Sugar as external changes happen. We can use notifications to increase user awareness of these changes. For eg; we can update contact information and notify the assigned user using Sugar Notifications.
Step 1: Create custom endpoint in Sugar
Create Sugar Notifications to implement approval or review workflows
Sugar Notifications can be very handy to implement approval/review workflow and notify a user or a user’s manager if any specific condition satisfies. For eg: the assigned user’s Manager gets a notification when an opportunity is created with a discount > 25%.
Step 1: Create before_save logic hook extension definition
Step 2: Create the logic hook action method
Here, we will check if opportunity discount percentage is >25%, we will notify assigned user’s Manager using Sugar Notifications
Se how easy it was to create Sugar Notifications? Sugar Notifications are a great tool for various other actions as well. You can use them with custom APIs, logic hooks, Sugar Jobs, etc, in order to notify users of record assignment, new record creation, record update, job status, etc.
Try out some ideas on your own and let us know what you come up with in the comments below!
Quick Tip: Check out this SugarCRM Knowledge Base article for adjusting Sugar Notification Delay – Setting Sugar’s Notification Delay