I have a flow from which I want to call a visualforcepage with some parameteres in the URL. The flow calls the invocable apex and the pagereference method but does not redirect to the url but does show the Screen test4 in the flow. What am I missing since I do not get redirected to an external URL. Why is the redirect method triggered but does not navigate to the given URL. I also do not have any exceptions.


public with sharing class  NavigateToUrl {

    //input details that comes to apex from flow
    public class InputParameters {

        public Case CaseRec;

        public Zuora__Subscription__c SubRec;

    //output details which goes from apex to flow
    public class OutParameters {

        public String Test1;

        public String Test2;

    @InvocableMethod(label = 'Navigate to URL' description = 'Navigate to URL')
    public static void getInputParams(List<InputParameters> InParam) {
        system.debug('Flow Invoked');
        redirect(InParam[0].CaseRec.AccountId, InParam[0].CaseRec.id, InParam[0].CaseRec.ContactId, InParam[0].SubRec);

    public static PageReference redirect(id AccountId, id CaseId, id Contactid, Zuora__Subscription__c Sub) {
        system.debug('redirect started');
        String baseUrl = string.valueOf(URL.getSalesforceBaseUrl());
        String gotoUrl = baseUrl + 'apex/' + 'shop?accountid=' + AccountId + '&caseid=' + CaseId + '&contactid=' + ContactId + '&subrec=' + Sub;
        PageReference newUrl = new PageReference(gotoUrl);
        return newUrl;


Result screen component enter image description here

2 Answers 2


If I understand correctly, the user experience will be the as soon as the user selects a radio button and click next he has to be navigated to the URL. If this is right then we do not need the Local Action but a Screen element built using a custom Aura Component that uses lightning:availableForFlowScreens.

In the example below I show Account as a selectable radio option in Screen 1 and then open the details page of the selected Account in Screen 2. Details below

Flow Screen 1 Screen 2- NavigatetoUrl Component

Design Attribute

js Controller ({invoke : function(component, event, helper) { // Get the record ID attribute var record = component.get("v.recordId"); var aUrl = "/"+record;

var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "isredirect": "true", "url": aUrl }); urlEvent.fire(); }})

  • I added the screen element with the component. For test purposes I added a testscreen after screen "open account" the test screen is reached but still the page does not navigate to the url. Please have a look at my updated image
    – Thomas
    May 12, 2020 at 15:45
  • What is the value assigned to the RecordId? are you able to navigate to the url generated manually?
    – ssoundiran
    May 13, 2020 at 6:12
  • I had a typo its resolved now. Thans for your help!
    – Thomas
    May 14, 2020 at 12:02
  • I'm glad I could be of help
    – ssoundiran
    May 14, 2020 at 12:13

You can achieve this using a Core Action flow component. Create a custom Aura component and map it to the Core Action and use navigatingToURL to open the VFPage from the Aura component.

A sample for reference

  • I tried this but this needs to be triggered by tthe create record component in my case I pass a record from a subflow so no record is created and thus the aura component isnt triggered
    – Thomas
    May 12, 2020 at 6:52
  • In the documentation the following is stated: When the local action is executed, the flow calls the invoke method,
    – Thomas
    May 12, 2020 at 7:05
  • Yes, when an Aura Component is called via a core action the invoke method is called. You can still pass the recordId from your subflow as an attribute to Core Action and build the vfpage url in the invoke method of the js controller using the recordId that is passed as the attribute value
    – ssoundiran
    May 12, 2020 at 7:21
  • In this case the subflow returns a collection of records (didnt metion this earlier) these are presented as a selection of radiobuttons when the user selects a radio button a recorId is selected but this selection is not a "executed local action" as stated in documentation to trigger the invocable method. This is the reason I tried this with an apex action. So I think your answer is not suitable for this case. So I need to call an invocable after selection of radiobutton/recordid (screen Test)
    – Thomas
    May 12, 2020 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .