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
GobbledigookGobbledigook 

Override Search?

Can the Search functionality in SFDC be overridden?  I want to limit the Solutions that return in the Search bar based on the UserRole, but not take them away completely

 

Is that possible?

rcravenrcraven

Gobble

 

I'm not sure if this will support your use case requirements.   You would need to specify filters dynamically based on user role and ensure that the filters are not visible to end user via UI.  This solution below overrides the home page basic search component.  However, you'll be directed to advanced search which you cannot override, the dynamic filters applied will remain in place if user used the home page search.  It would be difficult to override the advanced search page altogether.

 

You can hi-jacked the basic home page search componet by utilizing a custom s-control and a custom html home page component that serves up the s-control in an iframe.  I'm sure you could probably do it using a visualforce as well.

 

Custom Advance Search

S-Control:

<div style="background-color: #D1F0FF"> 
<form target="_parent" action="/search/SearchResults?" id="sbsearch" method="GET" name="sbsearch" onsubmit="if 

(window.ffInAlert) { return false; }if(this.sbstr){this.sbstr.blur();}"> 

<input name="searchType" id="searchType" value="2" type="hidden" /> 
<input name="sen" id="sen" value="a0Q" type="hidden" /> 
<input name="sen" id="sen" value="a0d" type="hidden" /> 
<input name="RECORDTYPETicket_Data_Form__c" id="RECORDTYPETicket_Data_Form__c" value="Procurement Request" type="hidden" 

/> 

<input class="searchTextBox" id="str" maxlength="80" name="str" size="23" title="Search" type="text" value="" /> 
<input value=" Go! " class="btn" name="search" title="Go!" type="submit" /> 
</form> 
<br />
 
<!-- DEV NOTES: 
sen=0 = search all items 
If SearchType=1 = basic search ,searchTexBox name=sbstr 
If SearchType=2 = Advanced search ,searchTextBox name=str 
--> 

</div>


Home Page Custom Component: (HTML) 

<IFRAME style="BACKGROUND-COLOR: rgb(232,232,232)" height=60 marginHeight=0 src="/servlet/servlet.Integration?lid=01NQ00000008TzY&amp;ic=1"frameBorder=0 width="100%" marginWidth=0 scrolling=no align=left></IFRAME>

 

  Hope this helps.