In this tutorial we will learn how to create and use Record Triggered Flow. The Record triggered flow can be used to fulfill requirements which requires us to write Trigger in Apex. Record Triggered Flow can be executed when
- A record is created
- A record is updated
- A record is created or updated
- A record is deleted.
We can run the flow
- Before the record is saved.
- After the record is saved.
Our hypothethical business users requirement is that when a new lead record is created in our Salesforce org, we must post a message to chatter. To handle different types of leads we have different chatter groups. Leads can have rating of Hot,Warm and Cold.
Here we will learn several new things
- A little bit of Chatter
- Use of Action to post something to chatter
- Use of Labels in a flow
- Use of Record Triggered Flow
Chatter - Chatter is a Salesforce real-time collaboration tool that lets your users work together, talk to each other, and share information. You can relate it to Whatsapp, Instagram messenger, etc.
So lets start by first enabling chatter in the org. Check the settings from Setup and make sure that it is enabled.
Now let us create 3 different public Groups based on the Lead Rating i.e. Hot, Warm and Cold Groups. Different agents/people can be assigned to the public groups to work on these leads.
Below are the steps to create a Hot Lead Group. You need to create similar groups for Warm and Cold.
Once we have all the configuration and pre-requisite in place, now lets create the flow. Create a new flow and select "Record Triggered Flow" option.
Now let us create 3 different text messages that we will post on chatter for Hot,Warm and Cold Lead respectively. Message for Hot Lead is shown below.
Now click on the "+" icon in the "Hot Lead?" outcome to add a chatter action.
In the new action box, search for messaging action. When you open the drop down you will see, "Post to Chatter" action. Here we will select the message that we want to post and the Group id, which we configured in the Label. In the Target Name or Id field, you will have to put the group id.
Do the same for Warm and Cold outcomes. After the outcomes are configured, this is how the flow will look like
Now save and activate the flow. To test this flow, we will have to create a new lead record in the org.
Go to the chatter tab, you will see a new message is posted in the chatter group














No comments:
Post a Comment