Final Up to date on December 5, 2022 by Rakesh Gupta
Massive Thought or Enduring Query:
- How do you Archive a Slack Channel utilizing Salesforce Circulation?
Slack Channels deliver order and readability to work — you may create them for each challenge, matter, or staff. When there’s a channel for every part, you may give attention to the conversations and work that issues most to you.
I’ve written just a few articles on Slack and Circulation. Why not verify them out if you are at it?
- Post a Message to a Slack Channel using Flow
- Send A Direct Slack Message Using Flow
- Create A Slack Channel Using Flow
On this weblog publish, I’ll go a step additional and provide help to to know the way to archive slack channels utilizing circulate. Earlier than studying this text, make sure you’ve learn Create A Slack Channel Using Flow article.
Aims:
After studying this weblog, you’ll have the ability to:
- Perceive when to make use of Run Asynchronous path
- Make exterior callouts by way of Circulation
- Use the choice component to verify the account’s fields worth
- Archive a Slack Channel utilizing the circulate
- And rather more
Martin Jones is working as a System Administrator at Gurukul on Cloud (GoC). Just lately GoC carried out the auto-creation of a Slack Channel for a brand new account. Now GoC’s higher administration desires to implement an auto-archival course of for the account’s Slack channel:
- If an account is marked as out-of-business (which may be recognized by means of a checkbox area on the Account title, Out of Enterprise).
Pre-requisites:
- Step one is to implement Create A Slack Channel Using Flow.
Automation Champion Strategy (I-do):
Add an asynchronous path to an After-save Document-Triggered Circulation circulate to combine with an exterior system and replace exterior objects with out writing code. The asynchronous path runs after the unique transaction for the triggering file is efficiently dedicated. For instance, use an asynchronous path to publish a message to Slack, replace a file in Heroku, or place an order utilizing a third-party achievement system.
Earlier than discussing the answer, let me present you a diagram of a Course of Circulation at a excessive degree. Please spend a couple of minutes going by means of the next Circulation diagram and understanding it. Let’s start constructing this automation course of.
Guided Apply (We-do):
There are Four steps to resolve Martin’s enterprise requirement utilizing Document-triggered Circulation. We should:
- Create a customized checkbox area (Out of Enterprise on Account)
- Outline circulate properties for record-triggered circulate
- Add a Determination component to verify Slack Channel Id area
- Add Archive Slack Channel motion
Step 1: Create a Custome Discipline – Out of Busines
- Click on Setup.
- Within the Person Interface, clicks on Object Supervisor.
- Navigate to Account | Fields & relationships and click on on the New button.
- Click on on the Checkbox information sort.
- Enter Discipline Label the Discipline Title will auto-populate.
- Click on on the Unchecked for the Default Worth.
- Add a area on the Web page Structure and grant area entry to the specified profiles.
- Click on Save.
Step 2: Outline Circulation Properties
- Click on Setup.
- Within the Fast Discover field, sort Flows.
- Choose Flows, then click on on the New Circulation.
- Choose the Document-Triggered Circulation possibility, click on on Create
- Object: Account
- Set off Alternative Circulation When: A file is created or Up to date
- Set Entry Standards
- Situation Necessities: All Situations Are Met (AND)
- Row 1
- Discipline: Out_of_Business__c
- Operator: Equals
- Worth: {!$GlobalConstant.True}
- Row 1
- Situation Necessities: All Situations Are Met (AND)
- When to Run the Circulation for Up to date Information: Solely when a file is up to date to satisfy the situation necessities.
- Optimize the Circulation For Motion and Associated Information
- Select the Choice to Embody a Run Asynchronously path to entry an exterior system after the unique transaction for the triggering file is efficiently dedicated.
- Click on Completed.
Keep in mind
- Asynchronous paths can be found for record-triggered flows that run after the file is saved.
- Asynchronous path choices are solely out there for flows which might be configured to run solely when a file is up to date to satisfy the situation necessities or choose the Is Modified operator in a situation.
- When a brand new or up to date file triggers your circulate to run, an asynchronous path is queued till it runs. You’ll be able to monitor an asynchronous path on the Time-Primarily based Workflow web page in Setup.
Step 3: Utilizing Determination Aspect to Examine Slack Channel Id Customized Discipline on Account
Now we’ll use the Determination component to verify whether or not the account’s Slack Channel Id area is populated. If the sphere is just not populated, we won’t take additional motion.
- On Circulation Designer, underneath the Run Asynchronously path, click on on the +icon and choose the Determination component.
- Enter a reputation within the Label area; the API Title will auto-populate.
- Beneath Final result Particulars, enter the Label the API Title will auto-populate.
- Situation Necessities to Execute Final result: All Situations Are Met (AND)
- Row 1:
- Useful resource: {!$Document.Slack_Channel_Id__c}
- Operator: Is Null
- Worth: {!$GlobalConstant.False}
- Row 1:
- When to Execute Final result: If the situation necessities are met.
- Click on Completed.
Step 4: Add Archive Slack Channel Motion
Now we’ll use the Archive Slack Channel motion to archive the account’s Slack channel.
- On Circulation Designer, beneath the Sure node, click on on the +icon and choose the Motion component.
- Search and choose the Archive Slack Channel from the dropdown menu
- Enter a reputation within the Label area; the API Title will auto-populate.
- Set Connection Values for Slack
- Slack App: Gross sales Cloud for Slack
- Slack Workspace: Automation Champion (Your Slack Workspace)
- Execute Motion As: Slack App
- Set Slack Channel Particulars
- Slack Channel Id: {!$Document.Slack_Channel_Id__c}
- Click on Completed.
In the long run, Martin’s Circulation will seem like the next screenshot:
As soon as every part appears good, carry out the steps beneath:
- Click on Save.
- Enter Circulation Label; the API Title will auto-populate.
- Click on Present Superior.
- API Model for Working the Circulation: 56
- Interview Label: Archive A Slack Channel Utilizing Circulation {!$Circulation.CurrentDateTime}
- Click on Save.
Nearly there! As soon as every part appears good, click on the Activate button.
Proof of Idea
Now onwards, if a enterprise person creates a brand new account with a score scorching, record-triggered after-save will robotically create a brand new Slack channel.
- Navigate to the Account new account Jardine Matheson Ltd, as proven within the following screenshot:
- Now login to Slack and take a look at the Slack channel.
- Slack Channel Id is saved within the customized area on the account.
- Subsequent time, when a person updates the account Out_of_business__C to True, as proven within the following screenshot:
- Document-triggered circulate robotically archives the account’s Slack Channel.
Formative Evaluation:
I need to hear from you!
What’s one factor you discovered from this publish? How do you envision making use of this new data in the actual world? Be happy to share within the feedback beneath.