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.
- Create a public group
- Create a flow to send an approval request
- Create an action button link to call the screen flow
- Add action link to page layout
- 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
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.
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}
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
Body | postBody |
IsRichText | true |
ParentId | recordId |
Status | Published |
Visibility | AllUsers |
Type | AdvancedTextPost |
3. Create an action button link to call screen flow
Create an action button to call the above created screen flow.
4. Add action link to page layout
Add the above-created action button on the page layout.
Flow:
Below is the flow diagram which I have created for this post.
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.
References:
Related Posts
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
Multi Select Lookup in Screen Flow
1 comment
[…] Post Chatter Feed Using FeedItem in Flow […]