---
schema_version: "1"
id: feef81c5a4e2f7d7e81672f4f0b9dde5539d985529a6e9ba7b60439ca77a6b2c
title: Getting Flow Variables
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_forcecom_visualworkflow_vars.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_forcecom_visualworkflow_vars.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 96cb40e7b4f7f36dcb720667d01fe234b50825565e502e58b4407ad3e25a6af7
description: You can retrieve flow variables for a specific flow in Apex.
---
# Getting Flow Variables

You can retrieve flow variables for a specific flow in Apex.

The Flow.Interview Apex class provides the getVariableValue method for retrieving a flow variable, which can be in the flow embedded in the Visualforce page, or in a separate flow that is called by a subflow element. This example shows how to use this method to obtain breadcrumb (navigation) information from the flow embedded in the Visualforce page. If that flow contains subflow elements, and each of the referenced flows also contains a vaBreadCrumb variable, the Visualforce page can provide users with breadcrumbs regardless of which flow the interview is running.

public with sharing class SampleContoller {

   // Instance of the flow
   public Flow.Interview.Flow\_Template\_Gallery myFlow {get; set;}

   public String getBreadCrumb() {
      String aBreadCrumb;
      if (myFlow==null) { return 'Home';}
      else aBreadCrumb = (String) myFlow.getVariableValue('vaBreadCrumb');

      return(aBreadCrumb==null ? 'Home': aBreadCrumb);

   }
}

#### See Also

- [_Apex Reference Guide_: Interview Class](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/flow_interview_class.htm "Apex Reference Guide: Interview Class - HTML (New Window)")