0

Situation : I have a screen flow that duplicate the record. What I need is to redirect it to the newly created record(duplicate) when the flow is finished.

Attempted workaround : 1 . Created a visualforce and call the instance of flow and modified the finishlocation.

Code: VFP

<apex:page Controller="AccountFlowController" >
    <br/>
    <flow:interview name="Developer_used" finishlocation="{!OID}" interview="{!myflow}"  >
        <apex:param name="name" value="Test"/>
        <apex:param name="recordId" value="XXXXXXXXXXXXX"/>
    </flow:interview>
</apex:page>

Controller:

public class AccountFlowController {

public Flow.Interview.Developer_used myFlow { get; set; }

public String getmyID() {
if (myFlow==null) return '';
    else {

        Account pack = myFlow.Account;
        return (string)pack.Id;

    }
}

public PageReference getOID(){
PageReference p = new PageReference('/lightning/r/Account/'+ getmyID() +'/view');
p.setRedirect(true);
return p;
}

}

the code works fine when it is not a screen flow. But when I added the screen on the flow it failed to start the flow Error : attempted to de referrence null object.

Is there any workaround on this matter?

  • VFP <apex:page Controller="OpptyFlowController" > <br/> <flow:interview name="Developer_used" finishlocation="{!OID}" interview="{!myflow}" > <apex:param name="name" value="Test"/> <apex:param name="recordId" value="XXXXXXXXXXXXX"/> </flow:interview> </apex:page> – hpmacugay Jul 10 at 9:00
  • Controller: public class OpptyFlowController { public Flow.Interview.Developer_used myFlow { get; set; } public String getmyID() { if (myFlow==null) return ''; else { Account pack = myFlow.Account; return (string)pack.Id; } } public PageReference getOID(){ PageReference p = new PageReference('/lightning/r/Account/'+ getmyID() +'/view'); p.setRedirect(true); return p; } } – hpmacugay Jul 10 at 9:01

Your Answer

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

Browse other questions tagged or ask your own question.