Sunday, September 24, 2023
HomeUncategorizedDelete Chatter Messages Utilizing Salesforce Stream

Delete Chatter Messages Utilizing Salesforce Stream


Final Up to date on June 22, 2022 by Rakesh Gupta

Massive Thought or Enduring Query:

How can customers be allowed to delete particular person Chatter messages?


After studying this text, the reader will have the ability to:

  • Use automation to extend person permissions
  • Create a customized object to retailer the Id of a Chatter message
  • Use Report-Triggered Stream to delete the Chatter Message

Rachel Gillett is working as a System administrator at Common Containers (UC). She has acquired a requirement from administration to permit their Gross sales reps (License Sort: – Salesforce Platform) to delete Chatter messages one-by-one from the Salesforce UI.

Automation Champion Strategy (I-do):

**Chatter Messages performance is simply out there in Traditional

First, it is very important perceive Chatter messages and Chatter Conversations in Salesforce. Chatter messages let you might have safe non-public conversations with different Chatter customers. Use messages to ship your colleague a query privately or to speak with just a few chosen individuals when a dialogue isnt related to everybody you’re employed with. A Chatter dialog consists of messages that dialog members have despatched or acquired.  

Bear in mind the next factors for utilizing Chatter messages

  1. A personal message can embody as much as 9 members, together with your self.
  2. Messages despatched won’t be viewable via Chatter feed, Chatter Profile, or World Search outcomes.
  3. You possibly can’t delete messages or conversations.
  4. An administrator with the Handle Chatter Messages permission can view and delete all customers messages in ChatterThis can be needed for compliance functions
    1. Messages are arduous deleted. They aren’t despatched to the Recycle Bin.
    2. Deleted messages aren’t included in message search outcomes.
    3. If all messages in a dialog are deleted, the dialog doesnt present in My Messages and mightt be retrieved through the Chatter REST API.
  5. If after studying the messages in a dialog you wish to mark the dialog unread, you are able to do so solely through the Chatter REST API, not through the person interface.

There are just a few attainable options for the above enterprise state of affairs, however I’ll use Salesforce Stream and Customized Object to resolve the enterprise requirement. As mentioned earlier, a System Administrator with the Handle Chatter Messages permission can view and delete all customers’ messages in Chatter. Enterprise customers aren’t allowed to delete messages or conversations.

In Salesforce the ChatterMessage object represents a message despatched as a part of a personal dialog in Chatter. There are some related fields to establish:

Area Identify Particulars
Id Chatter Message Id
ConversationId The ID of the dialog that the ChatterMessage is related to.

Earlier than discussing the answer, let me present you a diagram of a Course of Stream at a excessive degree. Please spend a couple of minutes going via the next Stream diagram and understanding it.

Let’s start constructing this automation course of.

Guided Apply (We-do):

There are Three steps to resolve Rachel’s enterprise requirement utilizing Report-triggered Stream. We should:

  1. Grant handle chatter permission 
  2. Create a customized object with few fields that might be used to avoid wasting the Id of the Chatter message, which the customers wish to delete
  3. Salesforce Stream Steps:
    1. Outline movement properties for record-triggered movement
    2. Add a call factor to test Chatter Message Id area will not be null
    3. Add a Delete Information factor to delete the Chatter Message

Step 1: Grant Handle Chatter Messages Permission to Customers

First, create a Permission Set to grant your person report Handle Chatter Messages permission. In any other case, you’ll get an error whereas constructing the Stream. The permission will be eliminated later.

Step 2: Create a Customized Object – Delete Chatter Messages 

Create a customized object (Delete Chatter Message) and a textual content area to avoid wasting the Chatter MessageId.

  1. Click on Setup.
  2. Within the Object Supervisor, click on Create | Customized Object.
  3. Now create a customized object Delete Chatter Message and fields as proven within the screenshot beneath: 
  4. Click on Save.

Just remember to have marked the sector Chatter_Message_Id__c as required and likewise granted CRUD entry to the respective profiles.

Step 3.1: Outline Stream Properties 

The following step is to create a Stream to implement the enterprise requirement, i.e. delete chatter message when somebody created a report within the customized object created in step #2. 

  1. Click on Setup.
  2. Within the Fast Discover field, kind Flows.
  3. Choose Flows then click on on the New Stream.
  4. Choose the Report-Triggered Streampossibility, click on on Create and configure the movement as follows:
    1. Object: Delete Chatter Message
    2. Set off the Stream When: A report is created
    3. Set Entry Standards
      1. Situation Necessities: None
    4. Optimize the Stream For Motion and Associated Information
  5. Click on Carried out.

Step 3.2: Utilizing Choice Aspect to Test If Chatter Message Id Area is Populated or Not

The following step is to test the chatter message-id area is populated or not. To test this, we are going to use the Choice factor.

  1. On Stream Designer, click on on the +icon and choose the Choice factor.
  2. Enter a reputation within the Label area; the API Identify will auto-populate.
  3. Beneath Consequence Particulars, enter the Label the API Identify will auto-populate.
  4. Situation Necessities to Execute ConsequenceAll Situations Are Met (AND)
    1. Row 1:
      1. Useful resource: {!$Report.Chatter_Message_Id__c}
      2. Operator: Is Null
      3. Worth: {!$GlobalConstant.False}
  5. Click on Carried out.

Step 3.3: Add Motion – Delete Information 

The following step is to delete the chatter message. For this, we are going to use the Delete Information factor.

  1. On Stream Designer, beneath the Sure node, click on on the +icon and choose the Delete Information factor.
  2. Enter a reputation within the Label area; the API Identify will auto-populate.
  3. For Find out how to Discover Information to Delete choose Specify circumstances.
  4. Choose the ChatterMessage object from the dropdown checklist.
  5. Set Filter Situations
    1. Row 1:
      1. Area: Id
      2. Operator: Equals
      3. Worth: {!$Report.Chatter_Message_Id__c}
  6. Click on Carried out.

In the long run, Rachel’s Stream will appear like the next screenshot:

As soon as every thing appears to be like good, carry out the steps beneath: 

  1. Click on Save.
  2. Enter Stream Label the API Identify will auto-populate.
  3. Click on Present Superior.
  4. API Model for Working the Stream: 55
  5. Interview Label: Delete Chatter Messages {!$Stream.CurrentDateTime}
  6. Click on Save.

Nearly there! As soon as every thing appears to be like good, click on the Activate button.  

Proof of Idea

  1. Logged in as Platform Person Brenda David (Customized Platform profile). Salesforce Platform User
    1. No further permission is assigned to this person other than Create and Learn permission on the Delete Chatter Message object.
  2. Brenda needs to delete a Chatter Message despatched by Gross sales Person Rakesh Gupta, however as a enterprise person when she will be able to’t run a question to get the IdChatter Conversation
  3. To get a Chatter Message Id, open the chatter message and right-click on it, after which choose Examine Aspect, as proven within the following screenshotSelect Inspect Element for a Chatter Message
  4. A window will open on the backside of the present display screen.  Discover and copy the Chatter Message Id as proven within the following screenshotChatter Message Id
  5. Create a brand new report within the Delete Chatter Message object, as proven within the following screenshotCreate a new record
  6. Navigate to the Chatter messages and test it out now. The message (i.e. What’s up?) despatched by System Administrator Rakesh Gupta will get deleted.

Final Output

Be aware: – You’re solely in a position to delete these Chatter messages by which you might be included, in any other case you’ll get an error. (There’s nothing in Salesforce matching your delete standards). It’s not relevant to the system administrator with the Handle Chatter Messages permission.

Formative Evaluation:

I wish to hear from you!

What’s one factor you realized from this submit? How do you envision making use of this new information in the true world? Be happy to share within the feedback beneath.




Source link



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments