Monday, October 17, 2016

Login Flow - Custom Maintenance Notification for Salesforce

Why do I need custom notification?
Many times we need a way to notify user about upcoming planned maintenance or release as soon as they login in. We might also need to broadcast important messages such as change in policies or upcoming events to all our users.

So what is the solution?
If you think about it, the solution is very easy. 
  1. Create a custom object or custom setting to store the notification
  2. Create a visual flow to read the notification stored in custom setting and display it on a screen
  3. Configure login flow to execute the visual flow when a user login
What is login flow?
Login flow provides the ability to build custom business processes and invoke them as users log in. This lets you integrate a custom process with the Salesforce authentication engine, as well as the ability for users to participate in the authentication decision process during the login process.
To be honest, Login flow is nothing new it was introduced in winter '15 release, however it is one of those under-utilized features that not many developer use. 

Detailed Steps:
Step 1: Create a custom object or custom setting to store the notification (we call it Bulletin Board)



Step 2: Create a new Flow (we call it Welcome Notification)

Step 2.1: Create a Fast Lookup element to get the records from Bulletin Board, assign the records to an Sobject Collection Variable (alertList), you can add filters to your lookup condition and also sort the records as per your requirement.




Step 2.2: Create a Loop element to iterate through the records (there could be multiple) and assign them to a Sobject Variable (AlertRec)




Step 2.3: Create an Assignment element to form the content that you want to display, Create text templates to format your content. I have used Bold Start, Bold End and New Line text templates.








Step 2.4: Create a Screen element to display the content



Step 2.5: Once you done creating these elements, your flow should look like, don't forget to mark your Fast Lookup as start element



Step 3: Create a new Login Flow (we call it Login Message), Select the Visual flow and profiles you want it to be enabled. 


Tip: Assign your Login Flow to a non System admin profile first. An incorrect login flow can lock you out of your org permanently.



No comments:

Post a Comment