Archive A Slack Channel Using Flow

Archive A Slack Channel Using Flow

Last Updated on December 25, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

  • How do you Archive a Slack Channel using Salesforce Flow?
Slack Channels bring order and clarity to work — you can create them for every project, topic, or team. When there’s a channel for everything, you can focus on the conversations and work that matters most to you.
I have written a few articles on Slack and Flow. Why not check them out while you are at it?
  1. Post a Message to a Slack Channel using Flow
  2. Send A Direct Slack Message Using Flow
  3. Create A Slack Channel Using Flow

In this blog post, I will go a step further and help you to understand how to archive slack channels using flow. Before reading this article, ensure you’ve read Create A Slack Channel Using Flow article.


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

  • Understand when to use Run Asynchronous path
  • Make external callouts via Flow
  • Use the decision element to check the account’s fields value 
  • Archive a Slack Channel using the flow
  • And much more

Business Use Case

Martin Jones is working as a System Administrator at Gurukul on Cloud (GoC). Recently GoC implemented the auto-creation of a Slack Channel for a new account. Now GoC’s upper management wants to implement an auto-archival process for the account’s Slack channel: 

  • If an account is marked as out-of-business (which can be identified through a checkbox field on the Account name, Out of Business).


  1. The first step is to implement Create A Slack Channel Using Flow.

Automation Champion Approach (I-do):

Add an asynchronous path to an After-save Record-Triggered Flow flow to integrate with an external system and update external objects without writing code. The asynchronous path runs after the original transaction for the triggering record is successfully committed. For example, use an asynchronous path to post a message to Slack, update a record in Heroku, or place an order using a third-party fulfillment system.

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 understanding it. Let’s begin building this automation process.

Guided Practice (We-do):

There are 4 steps to solve Martin’s business requirement using Record-triggered Flow. We must:

  1. Create a custom checkbox field (Out of Business on Account) 
  2. Define flow properties for record-triggered flow
  3. Add a Decision element to check Slack Channel Id field
  4. Add Archive Slack Channel action

Step 1: Create a Custom Field – Out of Business

  1. Click Setup.
  2. In the User Interface, clicks on Object Manager.
  3. Navigate to Account | Fields & relationships and click on the New button.
  4. Click on the Checkbox data type.
  5. Enter Field Label the Field Name will auto-populate. 
  6. Click on the Unchecked for the Default Value.
  7. Add a field on the Page Layout and grant field access to the desired profiles. 
  8. Click Save.

Step 2: 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 
    1. Object: Account
    2. Trigger the Flow When: A record is created or Updated
    3. Set Entry Conditions
      1. Condition Requirements: All Conditions Are Met (AND)
        1. Row 1
          1. Field: Out_of_Business__c
          2. Operator: Equals 
          3. Value: {!$GlobalConstant.True}
    4. When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements.
    5. Optimize the Flow For Action and Related Records
    6. Choose the Option to Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.
  5. Click Done.

  1. Asynchronous paths are available for record-triggered flows that run after the record is saved.
  2. Asynchronous path options are only available for flows that are configured to run only when a record is updated to meet the condition requirements or select the Is Changed operator in a condition. 
  3. When a new or updated record triggers your flow to run, an asynchronous path is queued until it runs. You can monitor an asynchronous path on the Time-Based Workflow page in Setup.

Step 3: Using Decision Element to Check Slack Channel Id Custom Field on Account

Now we will use the Decision element to check whether the account’s Slack Channel Id field is populated. If the field is not populated, we will not take further action. 

  1. On Flow Designer, under the Run Asynchronously path, 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.Slack_Channel_Id__c}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.False}
  5. When to Execute Outcome: If the condition requirements are met
  6. Click Done.

Step 4: Add Archive Slack Channel Action 

Now we will use the Archive Slack Channel action to archive the account’s Slack channel. 

  1. On Flow Designer, below the Yes node, click on the +icon and select the Action element.
  2. Search and select the Archive Slack Channel from the drop-down menu
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Set Connection Values for Slack
    1. Slack App: Sales Cloud for Slack
    2. Slack Workspace: Automation Champion (Your Slack Workspace) 
    3. Execute Action As: Slack App
  5. Set Slack Channel Details
    1. Slack Channel Id: {!$Record.Slack_Channel_Id__c}
  6. Click Done.

In the end, Martin’s Flow will look like the following screenshot:  

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label; the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 56
  5. Interview Label: Archive A Slack Channel Using Flow  {!$Flow.CurrentDateTime}
  6. Click Save.

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

Proof of Concept

Now onwards, if a business user updates an Account Out of business to True, then record-triggered after-save will automatically archive Slack channel created for the account.

  1. Navigate to the Account tab and create a new account Jardine Matheson Ltd, as shown in the following screenshot:
  2. Now login to Slack and check out the Slack channel.
  3. Slack Channel Id is stored in the custom field on the account.
  4. Next time, when a user updates the account Out_of_business__C to True, as shown in the following screenshot:
  5. Record-triggered flow automatically archives the account’s Slack Channel.

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.

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

Leave a Reply

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