Ask Search:
Robert GilmoreRobert Gilmore 

How to create login flow that only launches if checkbox "x" is "false"?

I have a login flow built, and the users who view the flow have the ability to mark a checkbox to "True" if they do not want to see the flow again. I don't know how to make the flow not launch if the user has a checkbox on their user account marked true. Can anyone send me in the correct direction?
Best Answer chosen by Robert Gilmore
Geoffrey FlynnGeoffrey Flynn
I managed to get a conditional login flow running, albeit rudimentary.  You can hopefully tweak it from here.  The post I liked above links to another post that would go through actually updating the checkbox with a RecordUpdate element

I didn't have any issues testing it, but this is new to me as well so do some testing for sure.

I created a formula field on the User object called "User Checkbox"

I have a flow that looks like this:

User-added image

I created a formula value within the Flow that looks like this:

User-added image

to bring back my User field.

I then used that formula value in a decision element:

User-added image

I then applied the RunFlow decision to a screen, and left the other one open-ended

User-added image


I then made this a Login Flow and boom goes the dynamite.  During testing I made sure to use a dummy account and profile, so that I didn't accidentally lock myself out of my own developer org if I threw an error, which would have been bad.

All Answers

Mayank SrivastavaMayank Srivastava
Robert,
As far as I know, Login flows can only be associated with profiles in an organization and not individual users. Also, you wouldn't want to give your users the ability to control the login flows (even if it is possible somehow via Flow Designer and using Apex together) since it should only be upto the administrator to enable/disable post authentication processes in an organization. I don't know of a way to accomplish your requirement declaratively unless a Flow expert can chime in and suggest something otherwise. (which I would be interested in knowing too)
Just my 2 cents.
Deepak AnandDeepak Anand
I don't think you can do that! If the Login Flows have been configured then they will be displayed to the end users. The quickest solution is this - 
  1. See if the Logged In User has the "Don't' Show" checked to TRUE
  2. If so back in the Flow, you'll make use of a Decision Element to route the control flow to a final Screen showing the link to the Home Page
    https://xxx.salesforce.com/home/home.jsp
    which the users can click to go to the Flow.
  3. You can make the same an Hyperlink so that Users can directly go to the Home Page clicking the same. Also back in Flows, you can even edit the HTML Markup of the Hyperlink after you put in the Rich Text and then set an attribute of target="_self" so the same Login Flow page reloads with Home Tab.
Geoffrey FlynnGeoffrey Flynn
I found this post
https://heathert93.wordpress.com/2015/02/12/using-login-flow-to-dynamically-create-notifications/

that is sparse on details but seems to point in the right direction
Geoffrey FlynnGeoffrey Flynn
I managed to get a conditional login flow running, albeit rudimentary.  You can hopefully tweak it from here.  The post I liked above links to another post that would go through actually updating the checkbox with a RecordUpdate element

I didn't have any issues testing it, but this is new to me as well so do some testing for sure.

I created a formula field on the User object called "User Checkbox"

I have a flow that looks like this:

User-added image

I created a formula value within the Flow that looks like this:

User-added image

to bring back my User field.

I then used that formula value in a decision element:

User-added image

I then applied the RunFlow decision to a screen, and left the other one open-ended

User-added image


I then made this a Login Flow and boom goes the dynamite.  During testing I made sure to use a dummy account and profile, so that I didn't accidentally lock myself out of my own developer org if I threw an error, which would have been bad.
This was selected as the best answer
Deepak AnandDeepak Anand
+1000K Geoff. That works like a charm! I tested in my DEV Org too. I am not cross posting purposefully but I just want to back his solution saying that's the SOLUTION to this!

Like as Geoff mentioned the key thing here is the Decision Element at the beginning and of course the final Record Update that updates the User record with selection that the user has made - 
 
User-added image
 

On the last Record Update, you'll have kinda like this - 
 
User-added image
 
where {!CurrentUserId} is actually a Formula like this - 
{!$User.Id}

So the lessons learned here(for us) - 
  1. Decision Element helps you to kick you out of the FLOW. 
  2. The introduction of the System / Global Variables into Flow this Summer' 15 - http://docs.releasenotes.salesforce.com/en-us/summer15/release-notes/rn_forcecom_flow_globalvars.htm [THIS IS GOING TO HELP US A LOT]
So the lessons learned here(for me) - 
  1. Was definitely worth trying before replying!
This is really nice and thanks a lot Geoff!
Mayank SrivastavaMayank Srivastava
Learnt something new today! Thanks to all (inlcuding Robert for posting this).
Robert GilmoreRobert Gilmore
Awesome! So cool to have support like this. Thanks all. 
Geoffrey FlynnGeoffrey Flynn
@Deepak - thanks for double checking.  I was convinced it was too good to be true with so little documentation kicking around