• New2SF
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi everyone,
I actually built a "simplified search" option for our sidebar, and our teams love it!  It is a combination of a visualforce page and javascript. Follow the 4 steps below to do the same.  Hope this helps!

1) Create a Visualforce page called "advancedsearch"
2) Use the following code as your page (Hint: for the "&sen=" portions in bold, these identify the objects you want to search.  For example, &sen=001 is an Account (click on the Accounts tab, and you will see those three numbers in the hyperlink).  My code below searches: Accounts, Opps, Contacts, Leads, and Campaigns

<apex:page showHeader="false" sidebar="false">
<apex:pageBlock >
<b>Enter search term: </b>
<apex:form >
<script>
function doSearch()
{
    var searchStr = document.getElementById('txtSearch').value;
    window.open('/_ui/common/search/client/ui/UnifiedSearchResults?sen=001&sen=003&sen=00Q&sen=006&sen=701&str=' + encodeURIComponent(searchStr), "_parent" );
}
</script>
<input type="text" id="txtSearch"/>
<input type="button" value="Go!" id="btnSearch" onclick="doSearch()"/>
</apex:form>
(<strong>NOTE:</strong> Only searches Accounts, Opps, Contacts, Leads, and Campaigns)
 </apex:pageBlock>
</apex:page>

3) Finally, go to setup > customize > home > home page components.  Create a new HTML area left sidebar component.  On the screen where you can enter in the HTML, make sure you select the checkbox "Show HTML" and then paste the following (this references your visualforce page and displays it in the sidebar):

<IFRAME height=150 src="/apex/advancedsearch?core.apexpages.devmode.url=1" frameBorder=0 width="100%"></IFRAME>

4) Add the custom component to your pagelayouts and test it out!