You need to sign in to do that
Don't have an account?
Ana K. Bertuzzi
Issue with Visualforce Page with both standard controller and extension (that calls a flow) - Loop
Hi everyone,
I've created a VF page with calls a flow and a controller I created to pull a variable from the flow and use it in the finishLocation.
The thing is that now I tried to map this VF page overriding a custom object's "New" button, and realized that to do so, I needed to add the standardController to that object so I can see it when trying to change my button. Then I changed the controller to extension and added the following to my class:
The thing is that after this change, when I click the finish button, instead of landing in the URL of the Record Type (variable from the flow), the flow restarts in a loop.
Is there anything that I should change in the class? or the VF page?
I don't know what I should put between the curly brackets, so I left it empty. I wonder if that is the issue. I'm not actually "getting" anything from My_Tickets__c object.
This is the VF page:
And the extension:
Thanks for your help!
Ana
I've created a VF page with calls a flow and a controller I created to pull a variable from the flow and use it in the finishLocation.
The thing is that now I tried to map this VF page overriding a custom object's "New" button, and realized that to do so, I needed to add the standardController to that object so I can see it when trying to change my button. Then I changed the controller to extension and added the following to my class:
public MyflowController(ApexPages.StandardController stdController) {}
The thing is that after this change, when I click the finish button, instead of landing in the URL of the Record Type (variable from the flow), the flow restarts in a loop.
Is there anything that I should change in the class? or the VF page?
I don't know what I should put between the curly brackets, so I left it empty. I wonder if that is the issue. I'm not actually "getting" anything from My_Tickets__c object.
This is the VF page:
<apex:page standardController="My_Ticket__c" extensions="MyflowController" TabStyle="My_Ticket__c"> <br/> <flow:interview name="My_Tickets" interview="{!Myflow}" finishLocation="{!LinkID}" /> </apex:page>
And the extension:
public class MyflowController { public MyflowController(ApexPages.StandardController stdController) {} public Flow.Interview.My_Tickets Myflow {get; set;} public String fullURL {get; set;} private String Instance = null; private void GetURL() { Instance = GetInstance(Instance); fullURL = 'https://' + Instance + '.salesforce.com/a1G/e?retURL=%2Fa1G%2Fo&RecordType=' + RTid() + '&ent=02I400000013Z1q'; } public PageReference getLinkID() { GetURL(); PageReference p = new PageReference (fullURL); p.setRedirect(true); return p; } public String RTid() { if (Myflow==null) return ''; else return Myflow.varRecordType; } public String GetInstance(String Instance) { if (Instance == null) { List<String> parts = System.URL.getSalesforceBaseUrl().getHost().replace('-api','').split('\\.'); if (parts.size() == 3) Instance = parts[0]; else if (parts.size() == 5) Instance = parts[1]; else Instance = null; } return Instance; } }
Thanks for your help!
Ana
All Answers
It worked but I had to use & instead of ?
It took me a while to figure it out.
Best regards,
Ana
?retURL=%2Fa1G%2Fo&RecordType=
?nooverride=1&?retURL=%2Fa1G%2Fo&RecordType=