I'm creating a login flow that allows/denies login access depending on if a user has a checkbox selected on their User record. If login access is denied, I want to show them a short message describing why they can't login, and then log them out.

The issue is:

After the flow decides whether they can log in or not, I can put in a new screen to tell them why they can't login. BUT, if they click "Finish" or "Next," it logs them in anyways. I tried to just do a force logout (LoginFlow_ForceLogout) via an Assignment, but that logs them out before they're able to see the message. I want to be able to (1) make the decision to not log them in (2) show them a message about WHY they can't log in (3) They click Finish and are automatically logged out.

Does anyone know what I'm missing?

enter image description here

4 Answers 4


Add a Screen element after Logout: My flow diagram

Then go to Setup/Security Controls/Login Flows and create an for a specific profile or select None to run it for all users:

Loginflow Entry

We use this concept when want to prevent users from entering the system during maintenance - by temporary assigning all user accounts to the Maintenance profile, and restoring them back when we are done. Do not assign Admin accounts to this :)


I figured it out. I had to

(1) get rid of the auto-logout assignment in my flow

(2) embed my flow in a Visualforce page with a finishLocation:

<apex:page >
    <flow:interview name="flowName" finishLocation="{!URLFOR('/secur/logout.jsp')}"/>

You need to add another screen after the assignment, it won't be seen but that will allow it to evaluate the force logout variable. This is 'hinted' at in the release notes - http://releasenotes.docs.salesforce.com/en-us/winter15/release-notes/rn_forcecom_security_login_flows.htm

The flow loads these values only after a UI screen is refreshed (a user clicking a button does not load the values, a new screen must be added to the flow for the values to be loaded).

Took me a bit to work out myself, but it is now working for me :)...


I am having similar issue, I am trying to logout by setting LoginFlow_ForceLogout as true but it is logging me in. Any inputs?

  • Hi! You have more chance of a good answer if you just log a new question. Jul 13, 2015 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .