Loading...

Tag: Communities

How to Add a Custom URL to Salesforce Communities

Salesforce has released an update that allows you to use a custom URL and perhaps more importantly a private SSL certificate with your customer and partner communities.

http://releasenotes.docs.salesforce.com/en-us/summer14/release-notes/communities_custom_domain_URL.htm

Before this update users would see “force.com” as the base domain (e.g. https://mycompany.force.com) after they logged in.

Setting up the custom URL and SSL certificate is relatively painless. You will need to do the following;

  1. Add the custom URL to Salesforce
  2. Generate a Certificate Signing Request from Salesforce
  3. Create a CNAME (Alias) record in your domain name registrar
  4. Generate an SSL certificate in your domain name registrar
  5. Upload the SSL certificate to Salesforce
Custom domains are supported only in non-sandbox instances. You can configure a custom domain in a sandbox instance and then migrate it to a production instance, but the custom domain is only active in production.

1. Add the custom URL to Salesforce

First, you should add the domain to Salesforce and get the organization’s unique API identifier value for your org.

  1. Login to Salesforce and navigate to Setup > Domain Management > Domains.
  2. Click the Add a Domain button.
  3. Enter your domain name (e.g. www.mydomain.com and click Save.
  4. Take note of the organization’s unique API identifier value which you will use later on when creating the DNS record.

Salesforce Domain Edit Screen

2. Generate a Certificate Signing Request

To generate the SSL certificate request you must first login to Salesforce to get a Certificate Signing Request.

  1. Login to Salesforce and navigate to Setup > Security Controls > Certificate and Key Management.
  2. Click the Create CA-Signed Certificate button.
  3. Fill out the values using the example below.
  4. Download the certificate request by clicking the Download Certificate Signing Request button.

https://help.salesforce.com/HTViewHelpDoc?id=security_keys_creating.htm&language=en_US

Salesforce Certificate Edit Screen

After you create a CA-signed certificate and certificate request, the certificate is not active and you can’t use it until it’s been signed by a certificate authority and uploaded into your organization.

3. Create a CNAME (Alias) record

To create the CNAME record you need to login to your domain name registrar and create the CNAME alias record with the following values.

Record type: CNAME (Alias)
Host: www.mydomain.com
Points to: www.mydomain.com.00dj0000000ibuhea5.live.salesforce.com

The points to value should consist of your domain, the organization’s unique API identifier, and the Salesforce base domain. (e.g. www.mydomain.com.ID.live.salesforce.com)

Here are instructions for some common domain registrars.

4. Generate an SSL certificate

If you haven’t already done so, purchase an SSL certificate for your domain. GoDaddy offers  a 1-year certificate for $69.99 per year.

  1. Login to your SSL certificate provider and navigate to the SSL certificate you want to use.
  2. Create a Certificate Request and provide the contents of the CSR file you generated before.
  3. After the CSR is validated download the certificate file.

Here are instructions for some common SSL certificate providers.

5. Upload the SSL certificate to Salesforce

For the final step login to your Salesforce org and upload the SSL certificate that was generated.

  1. Login to Salesforce and navigate to Setup > Security Controls > Certificate and Key Management.
  2. Select the certificate you created earlier.
  3. Click the Upload Signed Certificate  button.
  4. Select the file then click the Save button.
  5. Navigate to Setup > Domain Management > Domains.
  6. Click Edit on the domain you configured earlier.
  7. Set the Certificate and Key to the certificate you created earlier.
  8. Click Save.

Your Salesforce Community should now be configured to use a custom url and HTTPS. When a customer or partner logs in they should be taken to https://www.yourdomain.com.

* Please note, it can take up to 48 hours for Salesforce to process the domain and certificate.

Take control of your Salesforce Communities Branding

html

If you have ever tried to build a custom branded community on Salesforce.com chances are you have run into a problem with Salesforce injecting its own HTML, CSS and JavaScript.

Some of the first things Salesforce introduced were the showHeader, sidebar and standardStylesheets attributes on <apex:page />.

These attributes allow you to control whether or not the standard Salesforce header/footer, sidebar and stylesheets (CSS) are rendered in the visualforce page.

  • If you set showHeader=”false” the header, footer, sidebar, and menu will not be rendered.
  • If you set sidebar=”false” the sidebar will not be rendered.
  • If you set standardStylesheets=”false” the Salesforce css files will not be included.

Summer ’13

In the Summer ’13 release Salesforce introduced the applyBodyTag, applyHtmlTag and docType attributes to <apex:page />.

These attributes allow you to control whether or not the html and body tags are rendered in the visualforce page.

Setting the applyBodyTag and applyHtmlTag to false gives you the ability to override the html tag, head tag, and body tags.

Setting the docType attribute to “html-5.0” prevents html5 tags and attributes from getting stripped away. This should make it much easier to work with HTML5 and JavaScript frameworks that use HTML attributes extensively.

Spring ’14

In the  Spring ’14 release Salesforce introduced the ability to use HTML5 pass-through attributes. This allows you to enable HTML5 features, such as client side validation.

To use the pass-through attributes all you have to do is prefix the attribute with “html-“. Adding html-placeholder=”Email” to an <apex:input /> will carry over placeholder=”Email” to the <input /> tag.

Putting it together

Putting it all together you almost have complete control over what is rendered.

<apex:page showHeader=”false” sidebar=”false” standardStylesheets=”false” applyHtmlTag=”false” applyBodyTag=”false” docType=”html-5.0″>
<html><body>
<header><h1>Subscribe</h1></header>
<apex:form html-novalidate=”true”><apex:inputText html-placeholder=”Email” value=”{!email}” /><apex:commandButton action=”{!subscribe}” value=”Subscribe” id=”theButton” /></apex:form>
</body></html>
</apex:page>

Even with all of the progress, there are still elements that get injected into the page that we cannot control.

In particular, these script tags are injected:
/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1392581006000
/static/111213/js/perf/stub.js

Do not fear!

Join me in up voting a Salesforce Idea to add an applyScriptTags=”false” that would work similarly to how applyHtmlTag does.

https://success.salesforce.com/ideaView?id=08730000000l22lAAA