For one of the projects out customer want to have a custom header in partner community, but it should show some info based on the user currently logged in. For that I can use VisualForce and inject it with HTML, but the problem is that I don't have the global search box or name drop-down anymore if I use it:

standard community header Standard community header. Global search and name drop-down are clearly visible

custom community header Custom community header. Here I only have the field that I added

Here's the code:

HTML header:

    var xmlhttp;
    if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else { // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {

VF page:

<apex:page showHeader="false" sidebar="false" standardStylesheets="false" controller="MyCommunityHeaderController">
    <apex:outputPanel id="MyHeader" layout="block" style="margin:40px;">
        <apex:outputText value="Hello {!userName}!" />

Apex controller:

public with sharing class MyCommunityHeaderController {

    public String userName { get; set; }

    public MyCommunityHeaderController() {
        userName = UserInfo.getName();

So no real rocket science.

VF page and Apex controller are quite basic and they just show the user's name(will add more to show, but that is not relevant to the question).

The HTML page injects this VF page into the header, so that we can use VF in the header(standard we can only use HTML or an image)

So the question is: how do I add/keep the global search and ability to logout/go to setup when I use custom header?

  • stupid question: ins't it just the showheader="false" part of you VF page? Commented Aug 3, 2015 at 8:08
  • @JurVanOerle nope. If I set it to true I'll get a header in this VF page that is actually this page itself, which has a header that is actually this page itself, which has a header that is actually this page itself... And so on, and so on, and so on... :)
    – Novarg
    Commented Aug 3, 2015 at 8:13
  • Hi @Novarg, any luck on this? Still looking for a solution on creating a custom header that keeps the global search + the drop down buttons for my settings and logout
    – sfdx
    Commented Feb 10, 2016 at 20:55

1 Answer 1


Isn't it just this:


Applied to your MyCommunityHeader page? That's what I've used in the past.

  • Thanks for your reply. I've seen it, but the problem is that this only gives the global search, but not that blue bubble with your name in it, so I still can't logout or go to "My Settings"
    – Novarg
    Commented Aug 3, 2015 at 8:48
  • Sorry, didn't notice that part of your question. TBH, I think you might have to build the UI parts yourself and just join them up to the relevant links for My Settings and Logout. Again, that's what I've done before, but the customer wanted to to look like it wasn't Salesforce so custom UI was actually a benefit.
    – Aidan
    Commented Aug 3, 2015 at 8:53

You must log in to answer this question.

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