You need to sign in to do that
Don't have an account?
Nicholas Zuaro
Page redirect after flow issues.
Hello,
I'd like to preface this with the fact that I'm incredibly new to Salesforce Development and most coding in general, actually. So please bear with me.
Ok,
I'm trying to create a handy little time-saving flow-powered button to help people create a New Sales Order as quickly as possible.
So the button is located on the Account page, so this way, it already has all of the accounts information to enter into the Sales Order. So basically, the flow looks up the account, Creates a Sales Order, and then is finished.
Initially I wanted the user to be redirected to the Sales Order they just created.
Initially, I had a functioning controller that looked like this:
Then, before seeing your post, I tried to do something like this:
Then, after seeing your post, I tried this:
Which failed so miserably, I couldn't even save it. (Pretty sure my first error was something along the lines of "controller="flowController" doesn't exist."
Is the controller and then this other set of code supposed to be two different pages? or one in the same?
I'd like to reiterate how new I am to all of this, but I'm trying to learn by working off of and disecting good examples like these!
Thanks so much for your help!
I'd like to preface this with the fact that I'm incredibly new to Salesforce Development and most coding in general, actually. So please bear with me.
Ok,
I'm trying to create a handy little time-saving flow-powered button to help people create a New Sales Order as quickly as possible.
So the button is located on the Account page, so this way, it already has all of the accounts information to enter into the Sales Order. So basically, the flow looks up the account, Creates a Sales Order, and then is finished.
Initially I wanted the user to be redirected to the Sales Order they just created.
Initially, I had a functioning controller that looked like this:
<apex:page standardController="Account"> <flow:interview name="New_Sales_Order_From_Account_Page" <apex:param name="vExistingAccount" value="{!Account.Id}"></apex:param> </flow:interview> </apex:page>
Then, before seeing your post, I tried to do something like this:
<apex:page standardController="Account"> <flow:interview name="New_Sales_Order_From_Account_Page" finishLocation="{!URLFOR('/' + Account.ID)}"> <apex:param name="vExistingAccount" value="{!Account.Id}"></apex:param> <apex:param name="New_SalesOrder_ID" value="{!$CurrentPage.parameters.New_SalesOrder_ID}" /> </flow:interview> </apex:page>Which I believe to have turned out to be a disaster.
Then, after seeing your post, I tried this:
<apex:page controller="flowController"> <flow:interview name="New_Sales_Order_From_Account_Page" interview="{!flDemo}" finishLocation="{!prFinishLocation}" /> public class flowController{ public Flow.Interview.New_Sales_Order_From_Account_Page flDemo {get;set;} public PageReference prFinishLocation { get { PageReference prRef = new PageReference('/' + strOutputVariable); prRef.setRedirect(true); return prRef; } set { prFinishLocation = value; } } public String strOutputVariable { get { String strTemp = ''; if(flDemo != null) { strTemp = string.valueOf(flDemo.getVariableValue(New_SalesOrder_ID)); } return strTemp; } set { strOutputVariable = value; } } } </apex:page>
Which failed so miserably, I couldn't even save it. (Pretty sure my first error was something along the lines of "controller="flowController" doesn't exist."
Is the controller and then this other set of code supposed to be two different pages? or one in the same?
I'd like to reiterate how new I am to all of this, but I'm trying to learn by working off of and disecting good examples like these!
Thanks so much for your help!
I just don't want you to think I'm ignoring or forgot about you. I havent been able to do anything with this yet.
Like I said, I'm very new to developer stuff so I'm still just trying to learn the ropes.
I didn't know that in order to create an Apex Class I had to do it in a Sandbox first, so I created a Sandbox and now i've been stuck waiting for it to refresh with all of the objects/flows/VF-Pages, etc. that I'll be needing to test with for what seems like a century.
So, thank you for the advice, I'll be getting back to you with my results as soon as I can have some!
-Nicholas Zuaro
Thanks so much, Andy.
I can't wait to finally learn all of this.
And this Sandbox Refresh is crazy, the suspense is killing me!
So!
I attempted to create an Apex Class that looked like this:
And it wouldn't let me save it because it says
Which, when I go to the flow, the Variable clearly does exist, is being assigned in the correct place, and is of the Input & Output Type.
I don't see what's wrong so early on already?
And that seemed to take as well. So I was about to go test it, but then I remembered that this needs to be an action/button on the Account Page and the flow needs to receive the variable of the account page the button was pressed from.
So I tried adding: to the controller above and it didn't take. It gave me this error:
I don't know what that means exactly but I'm sure there's a better way to assign the variable now? Do I need to do that in the Apex Class created earlier?
& If so, where should it be? Should it still be like "<apex:param name="vExistingAccount" value="{!Account.Id}"></apex:param>" ??
Thanks again so much!!
I was wondering if there were any updates on this issue? I have acheived a very similar redirect using the post from Andy but when deploying to production I have to build the test classes for this and I have no idea what to write in them. I am very new to Apex development and have read how to test triggers on new objects and such but in this flow redirect stuff... any help with the test class for this code discussed above would help! Thanks