Getting Started with Process Builder – Part 13 (Auto Post a Message to Chatter When an Event is Created)

Getting Started with Process Builder – Part 13 (Auto Post a Message to Chatter When an Event is Created)

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 GroupI 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: 

  1. Create a chatter group
  2. Create a public calendar 
  3. Find the public calendar Id
  4. Creating a custom label to store public calendar Id
  5. Define process properties
  6. Define evaluation criteria
  7. Define process criteria 
  8. Add action – post to chatter

Step 1: Create a Chatter Group

  1. Navigate to App Launcher and click on the Groups.
  2. Clicks on the New button
  3. Name the Group and make sure to select the Private Access Type.
  4. Click Save.

Step 2: Create a Public Calendar Universal Container Conference Rooms

  1. Click Setup.
  2. In the Quick Find box, type Public Calendars and Resources.
  3. Clicks on the New button
  4. Name the Calendar and make sure to select the Active checkbox.
  5. 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. 

  1. Click Setup | Developer Console 
  2. In the Query Editor, run the following SOQL query 
    1. Select id, name from Calendar where (name=’Universal Container Conference Rooms’)
  3. Make sure to copy the Id. 

Step 4: Creating a Custom Label 

  1. Click Setup.
  2. In the User Interface, type Custom Labels.
  3. Clicks on the New Custom Label button.
  4. Enter Short Description the Name will auto-populate. 
  5. Now enter the UC Conference Room ID in the Value.
  6. Click Save.

Step 5: Define Process Properties

  1. Click Setup.
  2. In the Quick Find box, type Process Builder.
  3. Select Process Builder, then click New.
  4. Name the Process and click the Tab button. The API Name will populate. 
  5. As a best practice, always input a description
  6. The process starts when A record changes.
  7. Click Save.

Step 6: Define Evaluation Criteria

  1. Click on the Add Object node to begin selecting the evaluation criteria.
  2. Select the Event object from the dropdown list.
  3. Start the process only when a record is created.
  4. Click Save.

Step 7: Define Process Criteria

  1. Click the Add Criteria node to begin defining the process criteria.
  2. Name the criteria.
  3. The criteria should execute actions when the conditions are met.
  4. Set Conditions
    1. Row 1
      1. Field: User | Assigned to ID (Calendar) | Calendar ID
      2. Operator: Equals
      3. Type: Formula
      4. Value: System Variable | Label | UC_Conference_Room_ID
  5. Select All of the conditions are met (AND)
  6. Click Save.

Step 8: Add Action – Post to Chatter 

  1. Below Immediate Actions, click Add Action.
  2. For Action Type, select Post to Chatter
  3. Name the action.
  4. Post to: Chatter Group
  5. Group: UC International Announcement
  6. Message:  
    1. An event is created for the public calendar “Universal Container Conference Rooms” click on the link below to learn more about it.
    2. URL > https://rakeshistom1234-dev-ed.lightning.force.com/{![Event].Owner:Calendar.Id}
  7. 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.

  1. Create a new event on the Public calendar Universal Container Conference Rooms 
      1. Click on the App Launcher
      2. In the Search Apps and items box, type Calendar and click it.
      3. Add a new event by clicking a timeslot in the calendar. 
      4. For the Assigned To field, select Universal Container Conference Rooms.
      5. Fill in the remaining details for the event like the screenshot below, then click Save.
  2. 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.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

13 thoughts on “Getting Started with Process Builder – Part 13 (Auto Post a Message to Chatter When an Event is Created)

  1. @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?

    1. 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).

  2. 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

    1. 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.

      1. 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.

        1. 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

  3. 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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.