System Admin is Only Profile That Can Use Chatter Feed Actios

Auto Post a Message to Chatter When an Event is Created

Last Updated on April 6, 2022 by

Big Idea or Enduring Question:

How do you automatically Post a message to the 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 to a Chatter Group , but a user can only join a maximum of 100 Groups . In the 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 Salesforce Flow.

Objectives:

After reading this blog, you'll be able to:

  • Use After-save Record-Triggered Flow to Post a message to Chatter
  • Use Get element to avoid hard coding of Id
  • Use the Decision element to validate the get records outcome
  • Auto-create a Post to Chatter when an Event is created

Business Use case

Brandon Schaefer is working as a System Administrator at Gurukul on Cloud (GoC). His organization wants to post a message to the Chatter Group UC Internal Announcements, 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.

Before proceeding, ahead, understand  the CollaborationGroup  object in Salesforce. It represents a Chatter group. While this can be solved using various automation tools like Apex Trigger, or Flow , we will use After-save Record-Triggered Flow . Check out this article to understand why we are using after-save record-triggered flow for this scenario.

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let's begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Brandon's business requirement using Record-Triggered Flow . We must:

  1. Create a chatter group
  2. Create a public calendar
  3. Salesforce flow
    1. Define flow properties for record-triggered flow
    2. Add a Text Template to construct the chatter post message body
    3. Create a formula to determine whether the event is created or updated
    4. Add a decision element to check if an event is owned by a public calendar
    5. Add a get records element to find the chatter group details (UC Internal Announcements)
    6. Add a decision element to check if the chatter group was found or not
    7. Add action post to chatter – to post a message to the chatter group

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.1: Define Flow Properties

  1. Click Setup .
  2. In the Quick Find box, type Flows .
  3. Select Flows then click on the New Flow .
  4. Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
    1. Object: Event
    2. Trigger the Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done .

Step 3.2: Add a Text Template to Construct Chatter Post Message

 Now we'll create an email template using the Text Template . The text template allowed you to specify the multi-line messages. It also allows you to use HTML code.

  1. Under Toolbox , select Manager, then click New Resource to create a text template.
  2. Input the following information:
    1. Resource Type : Text Template
    2. API Name : textT_MessageBody
    3. Select View as Plain Text
    4. Body
      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/{!$Record.Id}
  3. Click Done .

Step 3.3: Formula to Determine Whether the Event is Created or Updated

  1. Under Toolbox , select Manager, then click New Resource to determine whether the record is created or updated.
  2. Input the following information:
    1. Resource Type : Formula
    2. API Name : forB_IsNew
    3. Data Type : Boolean
    4. Formula : IsNew()
  3. Click Done .

Step 3.4: Using Decision Element to Check if Event is Owned by Public Calendar

Now we will use the Decision element to check if the event is owned by the public calendar Universal Container Conference Rooms .

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details , enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.Owner:Calendar.Name}
      2. Operator: Equals
      3. Value: Universal Container Conference Rooms
    2. Click Add Condition
    3. Row 2:
      1. Resource: {!forB_IsNew}
      2. Operator: Equals
      3. Value: {!$GlobalConstant.True}
  5. When to Execute Outcome : If the condition requirements are met .
  6. Click Done .

Step 3.5: Adding a Get Record Element to Find Chatter Group – UC Internal Announcements

The next step is to use the Get Records element to find chatter group UC Internal Announcements details.

  1. On Flow Designer, below the Yes node, click on the +icon and select the Get Records element.
  2. Enter a name in the Label  field; the API Name will auto-populate.
  3. Select the Group (CollaborationGroup) object from the dropdown list.
  4. Select All Conditions Are Met (AND) .
  5. Set Filter Conditions
    1. Row 1:
      1. Field: Name
      2. Operator: Equals
      3. Value: UC Internal Announcements
  6. How Many Records to Store:
    1. select Only the first record
  7. How to Store Record Data:
    1. Choose the option to Automatically store all fields .
  8. Click Done .

Step 3.6: Using Decision Element to Check If Chatter Group was Found or Not

Now we will use the Decision element to check the Record Variable from step 3.5  to find if it returns the Chatter group UC Internal Announcements  or not.

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details , enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome:All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!Get_Chatter_Group}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.False}
  5. When to Execute Outcome : If the condition requirements are met .
  6. Click Done .

Step 3.7: Add Post to Chatter Action to Post a Message to Chatter Group

Now we will use the Post to Chatter static action to post a message to chatter group UC Internal Announcements.

  1. On Flow Designer, below the Group Found node, click on the +icon and select the Action element.
  2. Search and select the Post to Chatter from the dropdown menu
  3. Enter a name in the Label  field; the API Name will auto-populate.
  4. Set Input Values
    1. Message: {!textT_MessageBody}
    2. Target Name or ID: {!Get_Chatter_Group.Id}
  5. Click Done .

In the end, Brandon's Flowwill look like the following screenshot:

Once everything looks good, perform the steps below:

  1. Click Save .
  2. EnterFlow Label  theAPI Name  will auto-populate.
  3. Click Show Advanced .
  4. API Version for Running the Flow : 54
  5. Interview Label : Post a Message to Chatter Group {!$Flow.CurrentDateTime}
  6. Click Save .

Almost there! Once everything looks good, click the Activate button.

Proof of Concept

Now onwards, if a user creates an event for the public calendar Universal Container Conference Rooms , then the Record-triggered flow will automatically post a message in the Chatter group UC Internal Announcements . 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 Announcements . 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? Feel free to share in the comments below.

tiptongroply.blogspot.com

Source: https://automationchampion.com/2022/04/04/auto-post-a-message-to-chatter-when-an-event-is-created-2/

0 Response to "System Admin is Only Profile That Can Use Chatter Feed Actios"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel