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
Varghese KiranVarghese Kiran 

How to access visual workflow variable in Apex class ?

Hey guys.,

I created a Flow in salesforce with some text fields and integrated those fields with contact object. And then I created a cisualforce page
<apex:page Controller="AddendumEntryController" >
    <flow:interview name="Youth_Flow_Registration" interview="{!myflow}" finishLocation="{!backToAddendum}" >
       
    </flow:interview>
</apex:page>



And the controller is,
public with sharing class AddendumEntryController {

    public Flow.Interview.Youth_Flow_Registration myflow{get;set;}
    public ID returnId = System.currentPagereference().getParameters().get('contactId');


  

    public PageReference getBackToAddendum(){

        if(myflow!= null) {
              returnId = myflow.contactId;
        }
        PageReference send = new PageReference('/' + returnId);
        send.setRedirect(true);
        return send;
    }
}



Here contactId is a variable in flow which is creade in RecordCreate component
What is here I am missing? Please help me with this.
logontokartiklogontokartik
can you confirm if the contactId variable in the flow is defined as Input/Output variable? That is a must requirement for accessing variables outside the flow.

https://www.salesforce.com/us/developer/docs/pages/Content/pages_flows_getting_values.htm