function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anoop Patel 11Anoop Patel 11 

Visual Flows & Login Flows

This is the first time I'm using visual flows and trying to combine it with login flows. The requirement is to have a service agreement accepted every quarter by users once they login. This only needs to be completed once a quarter so a record lookup is required to check if this has happened. I have started to create the flow using a screen where a user enters their username (again but only for testing the rest of the flow), I want to avoid this and perhaps see if it is possible to pull direct from the standard login page? This then checks the existing records (at the moment just on username) but here I want it to also check the date to make sure that there is a record within the quarter using the standard created date. If there is a record then no further action is required but if there isn’t, then a screen where the agreement is displayed appears and a user must agree to progress. Once they have the finish button should take them to the standard home.

My issue areas are:
  • Pulling the username from the standard login page if possible or another way without the user having to enter the information again. (in the background hopefully).
  • Checking criteria to see if a record exists for the current QTR.
  • If a record does exists then DO NOT enter the follow. (where my current screen just says no action required, it should bypass this and re-direct to home page with the user having to see this screen then click finish).

User-added image
Best Answer chosen by Anoop Patel 11
Heather ThompsonHeather Thompson
I just dealt with some similar issues and wrote about it here (https://heathert93.wordpress.com/2015/02/12/using-login-flow-to-dynamically-create-notifications/). To use the Current User ID, you need to create a variable and use {!LoginFlow_UserId} in the variable. 

All Answers

ShashankShashank (Salesforce Developers) 
The current user Id should be available for use in a login flow (LoginFlow_UserId). See this: https://developer.salesforce.com/page/Login-Flows#Collect_and_update_user_data_during_the_login_process

You can use a decision element to redirect the flow to a finish screen directly.
Heather ThompsonHeather Thompson
I just dealt with some similar issues and wrote about it here (https://heathert93.wordpress.com/2015/02/12/using-login-flow-to-dynamically-create-notifications/). To use the Current User ID, you need to create a variable and use {!LoginFlow_UserId} in the variable. 
This was selected as the best answer
ShashankShashank (Salesforce Developers) 
I just tweeted your blog :) https://twitter.com/shashforce/status/565825366556565507
Anoop Patel 11Anoop Patel 11
Thank you Heather your blog is brillaint really helped me out.