2

Good day Everyone I have created a flow which I embed inside visual force page. After the flow process, I want to redirect the page to external url like 'www.google.com'. The problem is that encounter an error saying

Invalid Page Redirection
The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance. For more information, see Insufficient Privileges Errors. 

Can you please explain the cause of this error and how to fix this? Below is some part of code. Thank you

VF Page:

<flow:interview name="sample_flow" interview="{!myFlow}" finishLocation="{!OID}" />

Class:

        public PageReference getOID(){
        String oppId = '';
        oppId = getmyID();
        system.debug('mOPP : '+oppId);
        List<Opportunity> listOpp = new List<Opportunity>();
        List<String> listOpptoCloseWon = new List<String>();//Jan 18

        if(String.isNotBlank(oppId)){
            listOpp = [Select Id, Name, AS_Product__r.Name, AS_Product__c from Opportunity where Id = :getmyID()];
            if( listOpp[0].AS_Product__r.Name.tolowerCase().trim() == 'student'){

                PageReference p = new PageReference('www.google.com');
                p.setRedirect(true); 
                return p;  
            }else{ // if not student

                PageReference p = new PageReference('/apex/PaymentPage?oppId='+getmyID());
                p.setRedirect(true);
                return p;
            }
        }else{
            system.debug('kELSE !!!');
            PageReference p = new PageReference('/apex/PaymentPage?oppId='+getmyID());
            p.setRedirect(true);
            return p;
        }

    }
0

As outlined in Salesforce Docs you cannot set an external url as the finishLocation.

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.