Home SalesforceFlow Post Chatter Feed Using FeedItem in Flow

Post Chatter Feed Using FeedItem in Flow

by Dhanik Lal Sahni

Salesforce Chatter is a collaboration tool to engage teams for discussing clients, cases, or other business activities. We can use Salesforce Flow to post chatter information on records, user statuses, or groups. This post will show how to post chatter feed using FeedItem in flow.

We can use Post to Chatter Flow Action as well to send chatter notifications. Post to Chatter action can not send formatted texts (rich text content) so we have to use the FeedItem object to create a chatter post.

Use Case:

Account opening team needs approval for opening an account. He/she sent the approval post to the approval team. The approval request will have all information about request which might contain links.

Solution:

We can create a Screen Flow to send chatter posts. We will use FeedItem object to create chatter posts.

  1. Create a public group
  2. Create a flow to send an approval request
  3. Create an action button link to call the screen flow
  4. Add action link to page layout
  5. Test functionality

1. Create a public group

Create a public group so that we can mention them in chatter posts. Add users based on your requirement.

Public Group Name – Notification Group

Public Group - SalesforceCodex

2. Create a flow to send an approval request

Create a screen flow that will get the current record id from the page and send a chatter post to public group with the required information.

a. Create a recordId variable

Create a recordId variable to get the current record id. This will be text type variable.

getting current record id in flow - SalesforceCodex

b. Create a formula to create record URL

Create a record link using the below formula

LEFT($Api.Enterprise_Server_URL_510, FIND( ‘/services’, $Api.Enterprise_Server_URL_510)) & {!recordId}

Create Record Link in Flow - SalesforceCodex

c. Get Public Group Information

Get public group information using the Get Records data element. The element name for getting record is Get Group. We will refer group id in the chatter post.

d. Create a Chatter post using FeedItem

Create a text template variable and add approval content to it. You can add content based on your requirement.

Text Template variable – postBody

Text Template Content-

Hello @[{!Get_Group.Id}]

Please approve this service request for account opening. Click on the below link to approve the request.

{!recordLink}

Create a record using Create Records data element. Select FeedItem as a record object.

Put data in atleast below fields

BodypostBody
IsRichTexttrue
ParentIdrecordId
StatusPublished
VisibilityAllUsers
TypeAdvancedTextPost

3. Create an action button link to call screen flow

Create an action button to call the above created screen flow.

Action Button in Salesforce Lightning

4. Add action link to page layout

Add the above-created action button on the page layout.

Add action button on page layout - SalesforceCodex

Flow:

Below is the flow diagram which I have created for this post.

Chatter Post Flow

5. Test Functionality

Now open the account record and click on the Get Approval button to post chatter information. This will call the above-created screen flow and post chatter.

Chatter Post in Salesforce Flow

References:

Feed Item

Related Posts

Generate Topic Followers List

Other Useful Posts

Shopify integration with Salesforce using Webhook

Data Transformation with DataWeave in Salesforce Apex

Generic Multi-Select Lookup Component

Secure Apex Code with User Mode Operation

Data Table in Screen Flow

Multi Select Lookup in Screen Flow

You may also like

1 comment

Multi Select Lookup in Screen Flow - SalesforceCodex November 21, 2022 - 5:19 am

[…] Post Chatter Feed Using FeedItem in Flow […]

Reply

Leave a Comment

Top 10 Salesforce Service Cloud Features Top 10 Best Practices for Lightning Flow Facts and Statistics for Salesforce’s Size and Market Share Top 5 Contract Management Salesforce Apps Top 10 Enterprise Integration Use Cases