Many times I found that organization wants to display Notice/Information after user login into Salesforce, similar like Salesforce downtime or maintenance notification. Displaying information after login will help the organization to spread the words to several folks.
Business Use Case
Higher management in Universal Container wants to develop a feature when a user login into Salesforce they want to display important information to them.
Solution for the above business requirement
I think this is a good use case to start with Login Flow. After Winter’15 release Login flow is generally available. To solve this requirement we will use Visual Workflow and Login Flow user. To develop this application follow the below instructions
1) First of all, create a custom object (Notice_Board__c) and field (DisplayText__c) to Save Information/Notice details that your organization wants to display at the time of login
2) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
3) Click on New Flow, it will open flow canvas for you
4) Now create a variable with name GetInfoText and we will use into the flow
5) Drag and drop a Record Lookup ( Give the name Get display text) on the window
- Select Object Notice_Board__c
- Enter criteria DisplayText__c != {!$GlobalConstant.EmptyString}
- Save DisplayText__c into the variable {!GetInforText}, same like the below screenshot
6) The next task is to display the information, to do that Drag and drop a Screen ( Give the name Display Information) on the window
- Add one Display Text (InformationToDisplay) and pass the variable {!GetInforText}
- You can also add color and Images into it, do to that you can use HTML code
7) Finally, our Flow will look like the following screenshot
8) Save the flow with name Login Flow then Activate it and close the canvas.
Create a Login Flow
Our next task is to create Login Flow so that our flow will fire/invoke when user login into system. To create a Login Flow follow the below instructions
1) Click on Name | Setup | Administer | Security Controls | Login Flows
2) Click on the New button
3) Enter the Login Flow Name, Select the flow, User license and Profile, It will look like the below screenshot
4) Once done click on the Save button.
It’s time to test this feature
To test this application follow the below steps
1) Create one record in object (Notice_Board__c) to save the display information, you can take help from the following screen shot
2) Login into Salesforce with user who has profile (i.e. AS in my above example) that mentioned in login flow
3) After successful login you will redirect to below notice board screen
Note: – I will suggest you to Implement this first on your developer org test it and then move it to Production.
48 thoughts on “Display notice when users log in to Salesforce”
Alena
Great article, thanks
Maureen
Is there a way to create a login flow that posts a message for ALL profiles? I don’t want to have to create a separate login flow for each of our profiles, but in searching I don’t seem to find a solution.
Rakesh Gupta
AFAIK, the answer is No.
Kevin Chew
Is there a way for me to detect the browser (IE11, chrome, Firefox) and display it?
If yes, how do I do that?
Thanks
Rakesh Gupta
Use LoginHistory object
Kevin Chew
Hi Rakesh,
Thank you for that tip, it worked. I have another follow-up question to the browser.
I am trying to configure a flow to check if Internet Explorer is detected, it will pop up a message but if it were other browsers, nothing will pop up (just a normal login)
I am unable to figure out the mechanics on how to implement an If-Else situation here. Can you please help me out?
Rakesh Gupta
Use LoginHistory object to grab the browser information
Diane
Can this work for communities?
Rakesh Gupta
Yes!
Vinay Kumar Jain
Could you please write a blog explaining how would it work in community and also it should only be shown only specific no. of times to logged user. We want to use this feature for onboaring the customers (say should this for first 5 times) to the customers so that he can get familiar with community and also use this feature for some urgent announcement say only one time to each user
Rakesh Gupta
Here is my suggestion for you – Create a field on User object to store the count. And then in the Flow (update the count) and display/Skip the Login Flow based on your requirement (5 or more)
Aditya
We are trying to do this but after the login flow user is going to a page which can not be accessed. Will Visualforce work at the end of the flow to push users to custom URL page ?
Rakesh Gupta
In your Flow create a Variable LoginFlow_FinishLocation (type string) – LoginFlow_FinishLocation (type string)—This attribute determines where to send the user when the flow completes.
In the default value of the variable – defined URL
Antony
Thanks. I tried that. now I am trying to login and I get this error “An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.”
Also I received an email from sandbox saying
Flow Details
Flow Name: SF_lOGIN_fLOW
Type: Flow
Version: 1
Status: Active
Flow Interview Details
Interview Label: SF lOGIN fLOW 7/6/2017 1:10 PM
Current User: Arun Govindan (00520000003e2vV)
Start time: 7/6/2017 1:10 PM
Duration: 0 seconds
How the Interview Started
Antony Test (00520000003e2vV) started the flow interview.
RECORD QUERY: Get_Login_Text
Find one Notice_Board__c record where:
Display_Text_2__c Equals
Result
Failed to find record.
Rakesh Gupta
Without looking at Debug Log it is very hard to identify the root cause. But in your case, it seems like Flow is Failed to find a record.
Antony
Hi Rakesh,
I lost you @ step 6, Once we drag and drop “Screen” to flow we have 3 tabs- 1.General info, 2.Add a field, 3. Field Settings.
Could you please explain what needs to be done here.?
Rakesh Gupta
1. Navigate to Add a field tab
2. Then add a Display Text”
3. Then configure it. Make sure to add {!GetInforText} varibale
Stacey
One more question! The field I added shows on each record on my custom object, but the alert will only show the information from the most recent field that I have updated. Is that by design? I would think the alert would show all of the information under each field.
Rakesh Gupta
It will depend upon your design, what you want to display. Remember :- Flow runs in user mode not in system mode
Stacey
It would be great for the log-in box to show any information that is listed in the field DisplayText. Right now that field is in three different locations but in one object. How would I accomplish that? I apologize, my experience with flow is VERY minimal.
Rakesh Gupta
Use Record Lookup element to get all the display text and save it in the different variable as shown in the following screenshot
https://rakeshistom.files.wordpress.com/2015/07/get-all-dsiplay-text.png
Now use Display Text field on Screen element to show the data from different variable as shown in the following screenshot
https://rakeshistom.files.wordpress.com/2015/07/display-message.png
Stacey
So does this record lookup replace the other lookup for the GetDisplayText? It looks like the screenshot is saying I need to create three different display text fields on my object. So how would I know which field already has something in it? Is there a way for me to post a screenshot so I can show you? This is a custom object if it makes a difference.
Rakesh Gupta
Can you please upload your document in Dropbox public folder and then share the link here
Stacey
https://www.dropbox.com/s/46tjmsy8prryqm9/Login%20Flow.docx?dl=0
Rakesh Gupta
You have to use Three different Lookup Elements to get the data from these records.
Stacey
Great, that worked. Is there something else that needs to be added or checked off if there is nothing in the “Display Text” field? Right now if there is nothing the box pops up still upon log-in but it is just empty.
Stacey
This is great! I set this up in my devorg and when I run the flow in the flow it works, but if I log in as a user nothing pops up. I’ve tried different profiles thinking it was a permission issue, but nothing changes. Any thoughts? Is it because I’m logging in via the Users and not logging out and typing in their password, or should it work both ways?
Rakesh Gupta
Hello Stacey,
It will only work for those users who have same profile that you have selected at the time of Login Flow creation. Yes, you have to be logged out and then login again, After successful login attempt a Login Flow will appear.
Rakesh
Adrianne
The notice page displays in the user’s Recent Items as a view only object. I can’t think of a way to suppress this with security, as they need view access to see the maintenance page.
Any ideas on suppressing the Maintenance Object from the user’s recent items?
Rakesh Gupta
Please ask your question again.
Carol
Thanks for the good information. Is there a way to have a url (link) display as the notice and after the user clicks on it and is taken to the url’s page, the notice no longer displays for that user when he or she logs in……but for users who have NOT clicked through, the notice will still display until they do so. Possible?? Thanks in advance.
Rakesh Gupta
Possible with some customisation.
Satya
Hi Rakesh,
Thanks for the post..we tried and it is working fine. Actually I’m trying to add VFP(Like agreement page) with in the Flow section instead of showing display information or Alerts. SF given “To add a flow to a Visualforce page, embed it using the component” But here I’m trying to add VFP to Flow.If you have any idea please guide me …
Thank You
Satya
Rakesh Gupta
Hi Satya,
Currently it’s not possible to add VFP to Flow. To solve your requirement (i.e. create a Agreement page) you can “read only” text and Check box.
Rakesh
Satya
Yeah I’ll try that. Thanks for the quick response.
Adrianne Baugh
We are hoping to use this for our release notes. Do you have any advice for creating notice boards over 255 characters?
Rakesh Gupta
Try to use Text Area(Long) field type instead of Text Area field and please let me know how it goes.
Adrianne Baugh
Thanks for responding. Yes, I tried both the other text types and there is an error saying they are not compatible with workflow. Was wondering if you knew of a workaround. I’ll keep researching!
Rakesh Gupta
Let me try it. Meanwhile can you please try with two Text Area fields something like field1 + field2
Yamini
Hi Rakesh, Thanks for your post. Is there any way to restrict the flow to run only once in a day when the user logs in? means display this message only once in the morning and not for nay subsequent logins in the same day
Rakesh Gupta
Not right now.
simplysfdc.blogspot.com
Very nice Rakesh, do you have idea if we need to implement to many profiles rather than create Login Flows for each profile?
Second, anyway to check if user already see it, can we skip the window?
Rakesh Gupta
Thanks Johan. No there is no way to create login flow in bulk for all profiles or selected profiles.
Jason
I think you left out a good part – that is to create a Notice Board record.
Rakesh Gupta
Yes, will update it shortly. Thanks
Jason
Yeah, because I enabled it for the System Admin profile, logged out and now can’t log back in because it always trips on the Flow error. But this is a cool idea. Thanks for posting!
Rakesh Gupta
Don’t play with your system admin account. Best practice is to test it by using custom profile.
Rakesh Gupta
Done!