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

Flow Variables: Current User information

I am looking to set up flow and was wanting to prepoluate varibales with User.AccountID and User.ContactID  I'm not seeing where I can access user variables in Flow.  Am I missing something?



You can prepopulate variable values directly in the flow url. So lets say you have you a flow with url xxx/flow/main and you want the to populate variable A in your flow. Your url would then look like xxx/flow/main?A=some_value. I'm not entirely certain how well this works with direct flow URL's, I had a <flow> tag on a visualforce page that this worked with. Good Luck!


I'm worried that this approach could be spoofed, especially if trying to check user permissions. A savvy user could figure out how to inject another user's profileID into the URL.  Thoughts?


If you need validation or security around your variables, it would make more sense to populate them using an Apex Callout. You need to create an Apex class that implements the Process.Plugin interface. 


Please create a extention controller and user apex:param or try to set values which are populatd by constructor of controller


<apex:page standardController="Account" extensions="AccountExtention" >

<flow:interview name="LandscapingQuestionnaire" finishLocation="{!EndPage}" interview="{!landscaping_interview}" buttonStyle="btn" >
<apex:param name="accid" assignTo="{!accid}" value="{!}"/>
<apex:param name="accName" assignTo="{!accName}" value="{!accout.Name}"/>

<apex:outputLabel value="{!landscaping_interview.percentagecomplete}"></apex:outputLabel>




I tried something similar in our dev environment but using global variables.  I created the matching variables in my flow, and it works correctly until I go to validate a change set containing the flow...  The validation error I get tells me No variable "ContactIdFlow" exists in the flow - when indeed it does.  Here is the code from the VF Page:


        <flow:interview name="FEPlacementRequest" finishLocation="{!EndPage}" interview="{!placementInterview}">
            <apex:param id="ContactIdParam" name="ContactIdFlow" value="{!$User.ContactId}"/> 
            <apex:param name="ContactName" value="{!$User.FirstName}"/>                                   

Make sure the active version of the flow has the variable. If no active version is found and you are an admin, the apex page will compile against the most recent deactivated versoin.



Thank you for the reply.  Yes the active version has it... in fact all stored versions have it as well.  I had to work around the issue by commenting those two lines out of my Visualforce page for moving the change set, then changing them back in the new org.  I will do some further testing today to see if I can figure out what's going on.

Heather ThompsonHeather Thompson
There's not exactly a User.ContactID and AccountID the same way there is in Apex, but you can create a current user variable using {!LoginFlow_UserId} to get the current user with a lookup field and save the ContactID field and look up Contacts and Accounts. You can see an example here (