function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SARI4SARI4 

How to use force.com site VF pages as callback page

Hi I have created a force.com site having two VF page, 1st page is main page where guest user enters details and submit. After submit code goes to third party application and after performing some action it come back to force.com sit again with Thank you message(2nd VF page).
Now my issue is here I have created two sites, one for the site home page(1st page) and another for the callback page(2nd page/Thank you page). Can I merge both the sites. If Yes then how? What should be my callback URL. I need exact URL of Callback page for setting in my thirdparty application.
Please help!
Sampath SuranjiSampath Suranji
Hi SARI4,
I suggest you to use a single site with relevant VF pages.
You can use a default VF page with a controller which check query string value and redirect to a relevant VF page
Here is a kind of example code,
DefaultVFPage VF page
<apex:page controller="defaultPageController" action="{!redirectToRelevent}">
</apex:page>
defaultPageController
public class defaultPageController {
     
    public defaultPageController(){
      
    }
    
    public PageReference redirectToRelevent(){
        string recType = ApexPages.currentPage().getparameters().get('pagetype');
        PageReference pr;
        try{
            if(recType =='welcome' ){
                 pr = new PageReference('/apex/yourFirsttVFpage);
                
            }
            else{
                  pr = new PageReference('/apex/yourSecondVFpage);
                
            }
            
        }
        catch(Exception ex){}
        return pr;
    }

}

When you defining the site set the 'DefaultVFPage' as the Active Site Home Page.
If you want to redirect to welcome page, use the site URL as below,
www.yoursiteURL?pagetype=welcome

Best regards
Sampath
 
Gaurish Gopal GoelGaurish Gopal Goel
Hi, the answer is very simple.

Suppose your force.com site URL is http://abcd.force.com and the second VF page name is ThankYou

Then the URL you need to put in your 3rd party app is http://abcd.force.com/ThankYou

Points to remember:
1. 
Make your ThankYou page available in your force.com site which I think you have already done.

If this answer solves your problem then mark it as the solution to help others. Thanks.