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
Kishan TrambadiyaKishan Trambadiya 

Is there any standard trigger for Cahtter Private message??

I want a trigger that is fire at the time when user send the private message to aother user. so through that trigger i can use a class to store private conversation. I have ChatterMessage Standard Object but i cant use any trigger on it. I also made the permission "Manage Chatter Messages" then after i am not able to make trigger on chattermessage sobject.

Jia HuJia Hu
Based on my understanding, ChatterMessage object doesn't support Trigger.
dhakobyandhakobyan
Hi,

This works for me:

trigger onPrivateMessageAdded on ChatterMessage (before insert) {
    ChatterMessage[] messages = Trigger.new;
    for (ChatterMessage currentMessage : messages) {

        system.debug(currentMessage.Body);

    }    
}

Please first make sure you have enabled the "Manage Chatter Messages and Direct Messages" permission under [Your Permission Set]->System Permissions.

Regards