• Vivek Salve
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

This is my Visualforce page

 

<apex:page standardController="Registration__c" extensions="CreateRegistration">
    <flow:interview name="Submit_a_Registration" interview="{!flowRegistration}"  finishlocation="{!FinishURL}" />
</apex:page>

 

I have trying to pick a value from Flow and form a URL.  

 

The controller is like this, 

public without sharing class CreateRegistration{

    public Flow.Interview.Submit_a_Registration flowRegistration {get;set;}
    String RegistrationObjPfix     =    '/' + Registration__c.SObjectType.getDescribe().getKeyPrefix();
    
    
    
    public CreateRegistration(ApexPages.StandardController sc){

    }

    public CreateRegistration(){

    }
    
    public String getRTypeID() {
        if (flowRegistration==null) {
            return '';
        }
        else    {
            System.debug('URL is ---'+ '/e?RecordType=' + flowRegistration.registrationrecordtypeid);    
            return '/e?RecordType=' + flowRegistration.registrationrecordtypeid;
        }
    }

    public pageReference getFinishURL()    {
         
        
        /*
        PageReference pgToFinish = flowRegistration!=null?
                                    new PageReference(RegistrationObjPfix + '/e?RecordType=' + flowRegistration.registrationrecordtypeid)
                                    :new PageReference(RegistrationObjPfix);
        */
        //PageReference pgToFinish =  new PageReference('/' + RegistrationObjPfix + '/e?RecordType=' + getRTypeID());
        PageReference pgToFinish =  new PageReference( RegistrationObjPfix + getRTypeID() );
        pgToFinish.setRedirect(true);
        return pgToFinish;
    }
    

}

 

 

The flow is supposed to do some functionality and pass the correct record type.  

 

When i see the debug log, the RTypeId is empty.  The URL clearly takes me to the record with 

/e?RecordType=

 in the end but fails to bring the recordtypeid.

 

i have tried almost all the permutations and combinations.  

 

Any help on this will be highly appreciated.