Posted at 9:10 AM by Rakesh Gupta, on July 17, 2018
Salesforce Flow allows us to automate business processes by building applications, known as Flows. Using Flows, a user can collect information; or, they can update, edit, or create records in Salesforce. Furthermore, Flowscan execute logic, interact with the Salesforce database, call Apex classes, Platform Events, and guide users through various screens to streamline the process of collecting and updating data.
Once a Flow is built, an Admin can make the Flow available to the right users or systems.
If you have a basic understanding of Apex then, you can write a query to get records and count the list size. For example, using Apex, one can get all Contacts that belong to city Alpharetta and, count list size, by writing the following code:
List<Contact> myContact = new List<Contact>();myContact = [Select id, Email from contact where Mailingcity ='Alpharetta'];system.debug('Size of List'+myContact.size());
Now suppose you wonder, can I achieve the aforementioned outcome by using Flow? Well, you are in luck! For, before the recent release, it was very complex to count the records in a Record Collection Variable (Kind of equivalent to Apex list).
But, since Spring’18release, a user can use an Assignment element to count the Record Collection Variable size and store that number in a variable without using the Loop element!
Business Use Case
Edward Backhouse is working as a System administrator at GurukulOnCloud. He received a requirement to count Contact records where Mailing city equals Alpharetta. The new feature of Flow to rescue!
The solution for the above business requirement
There are a few possible solutions for the above business scenario. One of them, of course, is to continue to use the old method, as shown in the preceding screenshot.
But, Edward is a Salesforce Ninja-like us! And, therefore, he is always on the lookout for feature enhancements. As a result, Edward knows that, after Summer’18, he can solve the above requirement efficiently! So, instead of resorting to the old method, he takes following the steps:
Edward navigates to Setup (Gear Icon) | Setup | Process Automation | Flows in Lightning Experience.
Then he clicks on the New Flow button – which, in turn, opens the Flow canvas.
Edward creates a Variable (to store record count) as shown in the following screenshot: Read the rest of this entry!
Posted at 9:26 PM by Rakesh Gupta, on January 29, 2015
Two-factor authentication is a security process in which the user provides two means of identification, one of which is typically a normal user credential and the other of which is typically something memorized, such as a security code. You can enable Two-factor authentication for users by addingTwo-Factor Authentication for User Interface Logins permission through a Profile or a Permission Set.
Objectives:
After reading this blog, you’ll be able to:
Understand what is two-factor authentication
How to build custom two-factor authentication using Flow
How to use Flow to send an email
Set up Login Flow
Business Use Case
Warren Masonis a System Administrator at Gurukul on Cloud (GoC). He received a requirement to implement Two-factor authentication for Partner Community users who are having profile Partner Community User Clone.
What is Two-factor Authentication?
Two Factor Authentication, or 2FA, is an extra layer of protection used to ensure the security of online accounts beyond just a username and password. This process is done to better protect both the user’s credentials and the resources the user can access.
Automation Champion Approach (I-do):
Usually, with Salesforce, multiple approaches are available to solve a business requirement. Choose the ones that are simple, straightforward, and consume fewer resources.
Let us solve this scenario using Flow and Login Flow – as this business case involves adding a second factor of authentication after the username and password verification. Before diving further, 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 7 steps to solve Warren’s business requirement using Salesforce Flow. We must:
Create a formula in the Flow to generate Security Code (We are using Current DateTime to do so)
Store Security Code in a Variable
Send Security Code to User via Email
Allow user to enter Security Code
Validate the Security Code
Add a Screen to display a failure message
Set up a Login Flow
Step 1: Create a Formula
Click Setup.
In the Quick Find box, type Flows.
Select Flows then click on the New Flows.
Select the Screen Flowoption and click on Create.
Navigate to the Manager tab and click on the New Resource.
Enter API Name and Description.
Select Number as Data type and enter the Description.
Drag-and-drop Screen element onto the Flow designer.
Enter Label theAPI Name will auto-populate.
On the Screen element, navigate to the Input section and double-click on the Number field, to add it on to the Screen element
Enter Label theAPI Name will auto-populate.
Make sure to select the Require checkbox.
Click Done.
Step 5: Validate Security Code
Drag-and-drop Decision element onto the Flow designer.
Enter Label theAPI Name will auto-populate.
On the FirstOutcome enter the Label theAPI Name will auto-populate.
When to Execute Outcome: All Conditions Are Met
Row 1:
Resource: {!VarNSecurityCode}
Operator: Equals
Value: {!Security_Code}
Click Done.
Step 6: Screen to display code Mismatched Error
Drag-and-drop Screen element onto the Flow designer.
Enter Label theAPI Name will auto-populate.
On the Screen element, navigate to the Display section and double-click on the Display Text field, to add it to the Screen element
Enter API Name.
You can now use a Rich-text editor to add content like Text, Image, URL, etc.
Click Done.
In the end, Edward’s Flow will look like the following screenshot:
Once you’re done, Save the flow and name it Two Factor Authentication. Do not forget to activate the Flow by clicking on the Activate button.
Step 7: Set up a Login Flow
Click Setup.
In the Quick Find box, type Login Flows.
Select LoginFlows then click on the New.
Select the Typefrom the drop-down Flow.
Enter Two-Factor Authentication as a Name.
The next step is to select Flow, User license,and Profile. Follow the steps as shown in the following screenshot:
Click Done.
It’s time to test the Login Flow
Now, if a User with profile Partner Community User Clonesuccessfully logged using a username and password, they will see to our Flow to complete the two-factor authentication process
Enter yourSecurity Code onto the screen input field and click on the Nextbutton, as shown in the following screenshot:
If the Security Code is matched then you will redirect to Salesforce (i.e. Partner Community) else it will display an error message.
–> To add a restriction on the number of unsuccessful attempts, you can add one subflow (It will Freeze the user’s account after three or more unsuccessful attempts). Check out the more advanced Login Flow use case here.
Great! You are done! Feel free to modify it based on your business requirement.
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.