Getting Started with Process Builder – Part 13 (Auto Post a Message to Chatter When an Event is Created)
Posted at 4:00 PM , on March 24, 2015
Last Updated on November 22, 2020 by Rakesh Gupta
Big Idea or Enduring Question:
How do you automatically Post a message to Chatter Group message when a user creates an event?
In Salesforce, Chatter Group represents the group of people. It’s a great way to boost collaboration in your organization. You can add unlimited members into a Chatter Group, but a user can only join a maximum of 100 Groups. In this article Post Opportunity details to a Chatter Group, I had discussed how to post Opportunity closed information to a Chatter Group using the Flow. In the current article, we will discuss how to post a message to the Chatter Group using the Process Builder.
Objectives:
This blog post will help us to understand the following
- How to use the post to chatter action in Process Builder
- Auto-create a Post to Chatter when an Event is created
Business Use case
Brandon Schaefer is working as a System Administrator at Universal Containers (UC). His organization wants to post a message to the Chatter Group UC Internal Announcement, whenever an event is created for the public calendar Universal Container Conference Rooms.
Automation Champion Approach (I-do):
Public Calendars and resources are for managing group activities or shared resources. By using Public Calendars, a group of people can track events of interest to all of them (e.g., Sales events, weekly knowledge sharing sessions, or training classes) or schedule a common activity (e.g., a team vacation calendar). For example, with resource calendars, multiple people can coordinate their usage of a shared resource such as a conference room, etc. An organization can create an unlimited number of calendars.
While this can be solved using various automation tools like Apex or Flow, we will use Process Builder. This is not something that can be accomplished with Workflow Rules.
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.
Let’s begin building this automation process.
Guided Practice (We-do):
There are 8 steps to solve Brandon’s business requirement using Process Builder. We must:
- Create a chatter group
- Create a public calendar
- Find the public calendar Id
- Creating a custom label to store public calendar Id
- Define process properties
- Define evaluation criteria
- Define process criteria
- Add action – post to chatter
Step 1: Create a Chatter Group
- Navigate to App Launcher and click on the Groups.
- Clicks on the New button.
- Name the Group and make sure to select the Private Access Type.
- Click Save.
Step 2: Create a Public Calendar Universal Container Conference Rooms
- Click Setup.
- In the Quick Find box, type Public Calendars and Resources.
- Clicks on the New button.
- Name the Calendar and make sure to select the Active checkbox.
- Click Save.
Step 3: Find the Universal Container Conference Rooms public calendar Id
The next step is to find out the Id of the public calendar Universal Container Conference Rooms. One possible workaround is to use the Developer Console.
- Click Setup | Developer Console
- In the Query Editor, run the following SOQL query
- Select id, name from Calendar where (name=’Universal Container Conference Rooms’)
- Make sure to copy the Id.
Step 4: Creating a Custom Label
- Click Setup.
- In the User Interface, type Custom Labels.
- Clicks on the New Custom Label button.
- Enter Short Description the Name will auto-populate.
- Now enter the UC Conference Room ID in the Value.
- Click Save.
Step 5: Define Process Properties
- Click Setup.
- In the Quick Find box, type Process Builder.
- Select Process Builder, then click New.
- Name the Process and click the Tab button. The API Name will populate.
- As a best practice, always input a description.
- The process starts when A record changes.
- Click Save.
Step 6: Define Evaluation Criteria
- Click on the Add Object node to begin selecting the evaluation criteria.
- Select the Event object from the dropdown list.
- Start the process only when a record is created.
- Click Save.
Step 7: Define Process Criteria
- Click the Add Criteria node to begin defining the process criteria.
- Name the criteria.
- The criteria should execute actions when the conditions are met.
- Set Conditions
- Row 1
- Field: User | Assigned to ID (Calendar) | Calendar ID
- Operator: Equals
- Type: Formula
- Value: System Variable | Label | UC_Conference_Room_ID
- Row 1
- Select All of the conditions are met (AND).
- Click Save.
Step 8: Add Action – Post to Chatter
- Below Immediate Actions, click Add Action.
- For Action Type, select Post to Chatter.
- Name the action.
- Post to: Chatter Group
- Group: UC International Announcement
- Message:
- An event is created for the public calendar “Universal Container Conference Rooms” click on the link below to learn more about it.
- URL > https://rakeshistom1234-dev-ed.lightning.force.com/{![Event].Owner:Calendar.Id}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Note:- Process Builder only allows you to post message type TextPost. If you want to post LinkPost or PollPost then, in that case, you have to use Flow and Process Builder.
Proof of Concept
Now onwards, if a user creates an event for the public calendar Universal Container Conference Rooms, then the Process Builder will automatically post a message in the Chatter group UC Internal Announcement. It’s time to test out the process.
- Create a new event on the Public calendar Universal Container Conference Rooms
-
- Click on the App Launcher.
- In the Search Apps and items box, type Calendar and click it.
- Add a new event by clicking a timeslot in the calendar.
- For the Assigned To field, select Universal Container Conference Rooms.
- Fill in the remaining details for the event like the screenshot below, then click Save.
-
- Check out the Chatter Group, UC Internal Announcement. The following post will be automatically added to the group wall.
Formative Assessment:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world?
Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.
13 thoughts on “Getting Started with Process Builder – Part 13 (Auto Post a Message to Chatter When an Event is Created)”
Preeti Kant
I didn’t get OwnerId field in Event Object please suggest me any step
Richa Upadhyay
Hi Rakesh, I am able to successfully post the message to chatter, but it doesn’t notify the user. Can you help me with that?
Bruce L. Stewart
@rakesh Any way to modularize this across sandbox refreshes? I’ve found even if a Group exists in SB with the same name as in production, I have to deactivate my PBs, and reactivate in sandbox, selecting the desired group.
I’ve looked through some of JenWLee’s blogs, but can’t think of a custom label, custom setting, or custom metadata way to get Process Builder to use the native Post-To-Chatter action to a Group, when I want to look up the group from 1 of these. Am I missing something? Do you get PB in Sandbox to post to group effortlessly after refreshes, or do you have to modify each PB?
Rakesh Gupta
I never encountered such scenario. But my suggestion would use Custom Label (to store Chatter Group Id) and refer this to process builder.
P.S.:- looks like your comment is marked as SPAM by WordPress (i don’t have any idea, how and why).
Nicola Mitcham
Hi Rakesh
I’m trying to via process builder create a chatter post onto the Opportunity record if certain products are contained in the Opp product.
I think I need what you refer to as Record Chatter Feed below, but the only 2 options I see are post to User or Chatter Group, how do you make this third option accessible from Process Builder please?
Thanks
Nic
Our final task is to add an Immediate action to the Process. Click on Add Action (Under Immediate actions) and select the type of action to create (In our case Post to Chatter) , enter the Name Post to Chatter. This action allows you to post a message on User Profile or Chatter Group or on Record Chatter Feed. In this case select Chatter Group UC Internal Announcement, as shown in the following screenshot
Rakesh Gupta
1) To enable “This Record” option under post to chatter action, make sure that you have enabled feed tracking for that particular object.
2) In your scenario, you are creating a PB on Opportunity Product and want to post a message to opportunity record. To achieve this, you have to use both Process and Flow.
Onttu Lindeman
Process builder wont let me post anything to chatter in my community anyone know why?
Rakesh Gupta
Could you please post the error you are greeting
Onttu Lindeman
It appears the process builder wont link at all to community, none of the partner community groups appear in the selection either
POST TO CHATTER: myRule_1_A2
Inputs:
text = Below are a few steps to get you up to speed with our new system. 1.Search Q&A for Onboarding- Post a message. 2. Search Q&A forOnboarding- Responding in a post Welcome to TSV Connect. 3. Search Q&A forOnboarding- How to like a post Welcome to TSV Connect. 4. Search Q&A forOnboarding- Share a post titled Welcome to TSV Connect. 5. Search Q&A forOnboarding- How to @mention on Welcome to TSV Connect. 6. Search Q&A forOnboarding-How to find and join groups.
type = USER
subjectNameOrId = {!myVariable_current.Id} (005U00000066yFrIAI)
Error Occurred: The record for this post was deleted.
M
Hi Onttu,
Its a pretty late reply but thought to answer anyhow – the issue is due to process builder deployed from one sandbox to another, it retains the chatter group salesforce id from the source org even when activated post deployment in target org. You will have to delete the post to chatter action in target and recreate it once more as it will now fetch the target org’s chatter group id.
Regards,
M
nadine.bauer@nefos.com
Is there a chance to use @Case.Owner for posting on his Chatter Feed?
Thanks
amber latif
how did you made the 15digits to 18 digits ID , i am applying the same thing but i believe this 3additional number in reference id is not allowing me to trigger the rule
please assist
Rakesh Gupta
Use the below link to convert 15 digit ID to 18 digit
https://rakeshistom2-developer-edition.gus.force.com/SalesforceIDConverter/