You need to sign in to do that
Don't have an account?
kka_zzzsai
Issue with Visual Flow - URL Redirect not working even after all the permutations tried
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.
Hi @Rajaram
This is the VF page with the javascript,
and the controller is,
Please note that the Flow has got a a screen element in the end. That screen will exist only for few seconds. The screen element will have words like, "If you do not see the screen take you to the concerned record, please click finish" or something like that.
All Answers
What happens on your page when you alter your VF to the following:
<apex:page standardController="Registration__c" extensions="CreateRegistration">
<flow:interview name="Submit_a_Registration" interview="{!flowRegistration}" finishlocation="{!FinishURL}" />
Record Type ID: {!RTypeID}
</apex:page>
Do you see the record type ID?
I appear to be having a very similar issue. Was asked to open a case on it last week, which I did but the proposed answer doesn't seem to be working. I too get a null value when passing back to the URL. The addition I'll add, and not clear if original poster had same, is that my variable is coming back from a subflow and not the Master Flow.
Ah yes.. when referencing <flow>.<variable> in your controller, it will work ONLY with the variable values in the main flow (The flow matching the type of <flow>)
However, no fear! With the Winter '13 release, we added a new method called GetVariableValue to the FLow object, which will get the value of subflow variables.
So you need to switch your call from
flowRegistration.registrationrecordtypeid
to
flowRegistration.getVariableValue("registrationrecordtypeid")
Hope this helps..
I will work on a blog post for this ..
Hi @Rajaram
I did that too and that returned empty string.
I came to know through salesforce that the flow needs to have a Finish flow to bring the data. But, in my case I have branched such that the flow might come into an end with in the first 1 step or 2nd step or 3rd step depending upon the choices the user makes.
Yes, I do not have 1 screen/step where all the decisions converge.
So, when the user clicks next, the flow might have already ended based on his choice selected in the first screen.
So, what I did was, I created a step/screen that converged all the steps. Then invoked the flow in my visualforce page and the flow variable was coming up with the necessary value. And, I wrote a javascript in a output panel that redirects the page to the necessary URL when the flow returns a valid recordType. With this, I can also route the entire flow to an external website as well.
Is there any other way to do this without having the final converged screen and javascript?
If you want me to post, the code, i can do that.
Yes.. if you have a flow without a screen element in the end, you may encounter the issue of variables being pased back to VF. Lemme check on this with devs.
Would defenitely like to see your js to get a better understanding on it..
Hi @Rajaram
This is the VF page with the javascript,
and the controller is,
Please note that the Flow has got a a screen element in the end. That screen will exist only for few seconds. The screen element will have words like, "If you do not see the screen take you to the concerned record, please click finish" or something like that.
I have created a custom button on Opportunity. The button when click calls the main flow. The main flow has many subflows depending on the radio buttons we select.
Now I have 2 visualforce page created. 1st page embeds the main flow and opens when opportunity custom button is clicked. Once I select my choice, it redirects to subflow. My second page calls when the main flow is finished that is at the end of the flow. But in my second flow I am not able to get the parameters which I pass from the first page . The page URL only redirect with the 2nd vf page name. If I enter the url by passing '/apex/pagename?varable='+id' then am getting a null value.
Please let me know how can I get the 2nd variable value in 2nd page. Also in my controller class I am getting both main flow and subflow variables like:
public Flow.Interview.RFPQuestionnaire mainFlow{get;set;} //main flow
public Flow.Interview.MS_X_Screen fileUpload {get;set;} //subflow