function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LudivineLudivine 

Update Unread By Owner field in Unread Leads view.

We are facing an issue with this view when the owner of the lead is assingned to a queue.
When a member of this queue opens the lead, it remains unread.
Salesforce support said this may be achieved with a trigger.
I wonder how I can write a trigger to update a record in a view?
All I am aware with trigger is the possibility to update a record if it is new or edited.
I don't know how to update a record with a trigger just by viewing it.
Do you have an example or a tutorial to share?
Thanks in advance for your help.
 
Carlos Campillo GallegoCarlos Campillo Gallego
Hi Ludivine,

As you say, triggers get triggered when DML operations take place (at least that I know!!) So my suggestion is to create a simple flow with Process Builder, which allows you to update the UnreadByOwner field (not like workflows) and this way you would avoid coding.
User-added image

You can set as firing criteria for example, the value of a custom checkbox that the user must check when he/she opens the lead (this is completely manual).

Hope this helps you, is the easiest way that has came to my mind to achieve this...

Regards
AmulAmul
Hi 
Ludivine,

You need to develop a Visualforce Page need to add the same VF Page in the Lead Page Layout.
And this Visualforce page..will automatically update the lead..and that will auto mark the lead as read.

let me know if i can help you. amulhai@gmail.com