2

I am trying to get back the id of a record created via a visual flow, I have try to use the same code as the following question on stack overflow https://stackoverflow.com/questions/10032799/how-do-i-get-a-variable-back-from-a-flow but I am keep getting null

This is my setup of the flow:

<flow:interview name="FWC" interview="{!myflow}" finishLocation="{!nextPage}" />

this flow creates an account with variable name: AccountID

and this variable has Input/Output Type: Input and Output

public Flow.Interview.FWC myflow{get;set;}    
public ID returnId = System.currentPagereference().getParameters().get('AccountID');
public string newPage;

public PageReference getnextPage(){
    if(myflow != null) {
        returnId = myflow.AccountID;
        newPage = '/fwcSubmitted?id=';                            
    }
    PageReference send = new PageReference(newPage + returnId);
    send.setRedirect(true);
    return send;
}
2

Well for everyone who has come with the same issue, this seems to be an bug on salesforce side. The code is correct, however my last screen is the one that creates the account, so if I make that screen second last or if i add an extra screen, the code will work fine.

This is a big issue, as it will imply the user to do an extra click.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.