• ken92
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

I have a flow, it's launched using a button on the Account form. I passed the ID successfully, the flow works as expected. At the end of the flow process I simply want to return to the Account screen where it started. Seems easy enough but I've exhausted my limited knowledge. 

 

I'm thinking i will need to implement a process.plugin class but I can't figure out how to redirect the page and termintate the flow. 

 

An example or hints would be much appreciated..

 

Thanks

  • June 04, 2012
  • Like
  • 0

Hello,

 

I am only getting 66% coverage with the following code, and was wondering how to go about getting full. The lack of coverage happens when the flow/interview is NOT null, but I'm not sure how to give it a value.

 

Here is my VF page:

<apex:page controller="IntakeController" tabStyle="Case" >
    <flow:interview name="Universal_Intake" finishLocation="{!FinishPage}"
        interview="{!myflow}" />
    <apex:PageBlock >
        <apex:outputText style="font-size:150%; color:red; font-weight:bold" 
        value="NOTE: Editing/Deleting below this point will interrupt your Universal Intake flow!" />
        <apex:detail subject="{!var_ParticipantId}" relatedList="true" />
    </apex:PageBlock>
        <apex:PageBlock >
        <apex:detail subject="{!var_FamilyId}" relatedList="true" />
    </apex:PageBlock>
</apex:page>

My Controller:

public class IntakeController {

    public Flow.Interview.Universal_Intake myflow {get;set;}
     
    public String getVar_ParticipantId() {
        if (myflow==null) return '';
        else return myflow.var_ParticipantId;
    }
    
    public String getVar_FamilyId() {
        if (myflow==null) return '';
        else return myflow.var_FamilyId;
    }
    
    public String getVar_AddressId() {
        if (myflow==null) return '';
        else return myflow.var_AddressId;
    }

    public PageReference getFinishPage(){
        //does address ID exist?
        if (getVar_AddressId()=='')
        {
        //no, use family ID instead which will exist
        PageReference p = new PageReference('/' + getVar_FamilyId() );
        p.setRedirect(true);
        return p;
        }
        else
        {
        //yes, use addressID
        PageReference p = new PageReference('/' + getVar_AddressId() );
        p.setRedirect(true);
        return p;
        }
    }
}

 

My Test class:

@isTest
public class TestIntakeController {

    public static testMethod void testMyController() {
              
        IntakeController controller = new IntakeController();
        
        PageReference testFinishPage = controller.getFinishPage();
        
        String GetParticipantId = controller.getVar_ParticipantId();
        String GetFamilyId = controller.getVar_FamilyId();
        String GetAddressId = controller.getVar_AddressId();
        
        }
}

 

I know I have to account for interviews that are NOT null, but again, am not sure how to do so. Any help would be appreciated.

 

NOTE: I do know about the flow designer forums, but posted here instead because those boards seem much less active than these. Apologies.