I'm building a custom Notification section, which provides notification or messages to multiple users on any particular object update, I've created a HTML page like Dashboard where I have added a Alert section or notification section, which shows a particular record updates, like there is a Object (table) lets call it ObjA, whenever a record is created or updated with some specific data into that object, for that update a message record is generated and which showed on user on the Notification section. now As moment user click or expend the notification section. that notification should be grayed out, means it is seen by that particular user, and next time when that user come to that page it should grayed out those notification which are seen/read by user. So its like our Email read/unread functionality.

Anyone have any idea how to achieve this functionality.

What I have done so far, I have created a new object called Notification and every time whenever there is any create or update on that First object (ObjA), I wrote a event based logic which create a new record in notification object and I'm reading that notification object all the time. On the notification I have created a field called "Status" which include Read/Unread option. Now I want your help to figure out how to set that field as "Read" on basis of every individual user.

P.S. - There are multiple users who sees this notification functionality, so if a UserA seen the message it doesn't mean that UserB also seen that, so userB still able to see that unread mark on the same message in the notification section.

Let me help what's the best way to achieve that.

Thanks in advance!

  • If you want to track the status on a per user level, then you must create a relation between Notification and User and make the status a property of that relation. – Bart van Ingen Schenau Dec 26 '16 at 9:43
  • Bart, I also look into the same approach, but in that case there will be huge amount of the data redundancy and also I need to create a separate table which relate User and Notification Object Status. In my scenario, I have around more then 100 K users who are going to get the updates for the change. so for every change I need to create more then 100 K individual rows for track. And I don't know how many times that object cab be updated, it can be updated 100 times in a day, So you can estimate how many rows needs to be create,That's the worry part. – user2809299 Dec 27 '16 at 7:21

I managed to get the solution for this issue,

One solution is off-course what @Bart suggested, in which we can create a another object which will act like a mapping object to messages and users which contains one to one relationship. The only downside is you in that case there will lots of records in the database for every time if any notification generates.


Second way is to create a long text area field on the same object Notification and give it a name like ReadBy, where we can store unique identifier ids of user in comma seperated manner, and everytime when user see check this ReadBy field for read and unread state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.