Find your content:

Search form

You are here

How do I use a custom URL for the Customer Portal

 
Share

I am trying to have my Customer Portal use a custom URL instead of the Salesforce one. The Salesforce one right now looks like this:
https://cs13.salesforce.com/secur/login_portal.jsp?orgId=orgId&portalId=portalId

I followed the instructions here to set everything up: http://wiki.developerforce.com/page/Authenticating_Users_on_Force.com_Sites

My SiteLoginController looks like this:

global with sharing class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl = 'https://cs13.salesforce.com/secur/login_portal.jsp?orgId=<orgId>&portalId=<portalId>';
        return Site.login(username, password, startUrl);
    }

    global SiteLoginController () {}

    @IsTest(SeeAllData=true) global static void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = 'test@salesforce.com';
        controller.password = '123456'; 

        System.assertEquals(controller.login(),null);                           
    }    
}

However, when I go to my login page and try and login, nothing happens. How do I get this to work?

Additionally, instead of my portal being at http://mycompany.test.cs13.force.com/apex/SiteLogin, I want it to be something like http://suport.mycompany.com. How would I do that?


Attribution to: Di Zou

Possible Suggestion/Solution #1

public PageReference login() {
String startUrl =    System.currentPageReference().getParameters().get('startURL');
return Site.login(username, password, startUrl);
}

Have a look at this section carefully and compare with your code please

Another source code and its working .You may like to try that

global PageReference login() {

  //static org-id and portal id
  String strOrgID = '';
  String strPortalID = '';
  String strURL = '';
  //start url of the page
  String startUrl = strUrl + '/secur/login_portal.jsp?orgId=' + strOrgID + '&portalId=' + strPortalID;

startUrl += '&un=' + username;
    startUrl += '&pw='+ password;

    //set reference and attempt login
    PageReference portalPage = new PageReference(startUrl);
    portalPage.setRedirect(true);
    PageReference p = Site.login(username, password, startUrl);

    //if p==null, no login
    if (p == null) {
          return Site.login(username, password, null);
    } else {
          return portalPage;
    }
}

This blog might help : http://threeheadsonapike.wordpress.com/2012/06/07/customized-salesforce-customer-portal/

For your second question have a look at this website

support.activision.com

Now you have company name .All you need to do is purchase the domain name and map in site settings to work

https://ap1.salesforce.com/help/doc/user_ed.jsp?loc=help&target=sites_configuring_sites.htm&section=integrate&instance=AP1&release=178.21.5

Custom Web Address The optional branded custom Web address that you registered with a third-party domain name registrar. The custom Web address acts as an alias to your Force.com address. To enable a custom Web address, create a CNAME record to your Force.com domain with that registrar. If you have not registered this address, you encounter an error. Custom Web addresses aren't supported for sandbox or Developer Edition organizations.Note If you choose to create a branded top-level domain or subdomain through a domain name registrar, the CNAME record that you provide to that registrar must be your Force.com domain name and not the site URL. For example, if you entered mycompany when registering your Force.com domain, the CNAME must be mycompany.force.com, not the full value of the site URL.

You will have a field in site settings to specify Custom web address .Need to put your company URL there.This feature avaialable in Production instance only


Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #2

You can use a custom web address. See http://www.salesforce.com/docs/developer/cookbook/Content/sites_using_custom_domain.htm for more info on setting that up.

Also, it is important to know that in your example above, you are using a sandbox instance (cs13). Custom web addresses are not supported on these instances. If you want to use a custom web address, you will need to use a production instance.


Attribution to: Ryan Guest

Possible Suggestion/Solution #3

Starturl should not be the full URL. /apex/pagename is what you need. For the default portal home page, you can use /home/home.jsp


Attribution to: Shane McLaughlin
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/2265

My Block Status

My Block Content