Search Community
- Force.com Discussion Boards
- :
- Salesforce User Discussions
- :
- Product Discussion
- :
- Re: Customizable Search HTML Components
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Customizab le Search HTML Components
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-09-2005 11:56 AM - last edited on 06-12-2009 11:47 AM
Occasionally, people have requested to have more flexibility in how search works on the homepage. Usually "Advanced Search" will solve most needs (searching customfields, etc)...however this solution may be interesting to you if you'relooking for more control and to do things like:
1) Sort Search Results
2) Search for Contacts within specific Accounts
3) Search specific fields rather than all fields
4) Bypass the search indexing of records ensuring that newly created records are always immediately available.
Below are instructions for salesforce.com administrators on how to create a custom HTML component for searching. This uses our report engine, HTML Components on thehomepage, and Javascript.
The user will be presented with a form which, when submitted, will pass variables to apre-defined report which will use those variables as the criteria from which tosearch. Because this utilizes our reporting functionality, users are able tosort the search results, search account fields on contacts, and search specificfields as specified in the HTML component.
Note: This solution is bound by the table joins that our Reporting Engine provides. In other words, if you are unable to report on all of the types of records in thesame report, you'll be unable to search them as well as this solution utilizes the reporting functionality. If this is a requirement, you would need to set upadditional HTML components to handle these different type of record searches.
1) Create a "summary" report for Accounts and Contacts in the format you'd likethem displayed on your search results page. Be sure to include any fields (suchas CSP, state, etc) that you’d like to sort on.
2) Go back to the "Select Criteria" screen and be sure the "View:"is set to "All Visible Accounts" and clear any dates in the daterange field.
3) Under the "Advanced Filters", choose the fields that you’d like to be searched.For instance, in the first drop down box, choose "First Name", in thesecond, choose "Last Name", in the third, choose "Account Name",etc.. You can set up to 10 fields to be searched from the custom advanced search page we’ll be creating later. To add more than 5, select "Advanced Options"on the "Select Criteria" page then "Add Row" for morefilters.
4) Set the "Operator" to "Contains" for all fields that you set.
5) Be sure to leave the actual value in any of the "Value" fields empty.
6) Save the report. Be sure to save the report in a publicly available folder. "Account and Contact Search" may be a good name.
7) Now that the report is saved, go to the "Reports" list and copy the URLthat links to that particular report. This URL is unique for that report and will be used for our advanced search a bit later on.
8) Clickon "Setup", "Customize", "Home", "Home PageComponents", and "New Custom Component".
9) Create a name for your search component ("Account and Contact Search", forinstance) and select "HTML Area" as the type. Select "Next".
10) Choose "Narrow" if you’d like your search to be on the left side of thescreen. Choose "Wide" if you’d like your search screen to be in the main section of the user’s home page.
11) In the "Formatting Controls" section, select "Show HTML"
12) In the body of the HTML, we must enter some Javascript. Essentially, this Javascript will allow the variables that are entered to be automatically passed into a URL. The URL will be the report URL for the report you created earlier (designated as REPORTURL below). This script should be customized based on yourreport URL and the filters which you are requesting users to search on.
<FORM action=https://REPORTURL method=get>
FirstName: <INPUT name=pv0><BR>
LastName: <INPUT name=pv1> <BR>
Company:<INPUT name=pv2> <BR>
<INPUT type=submit value="Submit Query"> </FORM>
In the example above, First Name, Last Name, and Company would be the first three filters on the "Select Criteria" of the report. As you add additional criteria,you must change the <INPUT name=pvX> to reflect the number of filter. So if you used all 10 filters, for instance, it would look like<INPUTname=pv9>.
13) De-Select" Show HTML" at any time to see what your advanced search screen lookslike as you’re building it.
14) Once completed, save your component. We must now add it to a home page layout.
15) Click on "Setup", "Customize", "Home", "Home PageLayouts".
16) Click on "Edit" next to the page layout that you would like to add this advanced search screen to.
17) Put a check next to the advanced search component that you created and click"Next".
18) Movethe search screen to where you’d like it to appear on the page and click save.
Your new account and contact search has been created. This combination of HTML Components, Javascript, and reports gives you as the administrator complete control over how searches are handled within Salesforce.com.
UPDATE:
If you'd like a private appexchange package that will install this into your org, follow these instructions:
http://community.salesforce.com/sforce/board/messa
Solved! Go to Solution.
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-04-2005 06:42 AM
Thanks,
Katie
Re: Customizab le Search HTML Components - Advanced Search
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2005 08:22 PM - last edited on 05-23-2005 08:22 PM
I modified the code to make an Advanced Search box appear on the Home Page.
I also changed the code for the button so the salesforce.com blue search button appears (just like in sidebar search) instead of the generic HTML button.
Here's my code (replace the "(" from the beginning of each tag--the forum wouldn't let me post straight javascript):
(FORM action=https://na1.salesforce.com/srch/advsearchre
Search This: (INPUT style="BACKGROUND-COLOR: #ffffa0" name=str>
(INPUT class=button type=submit value=Search name=search>
(/FORM>
-Chris
Message Edited by Chris P on 05-23-2005 08:23 PM
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-29-2005 06:50 PM
I do have a question, though.
If I were to add a "City" search box on the new form, is there a way to pass the entered text to two separate parameters in the report.
The reason I ask - we have multiple address records on each of our contacts, and I would like the report to bring back any records with the entered city on any of it's address records.
I realize that I could add multiple "City" search fields, but I don't want my users to have to enter the same city multiple times.
Anyone have any suggestions?
Thanks,
RK
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-06-2008 01:54 PM
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-06-2008 02:06 PM
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-15-2008 04:01 PM
Unfortunately there's no way to selectively show custom sidebar components based on which tab you're looking at... it's either an all or nothing scenario when you click off on the "Show Custom Sidebar Components on All Pages" checkbox.
If instead of tab based, you can have it user based... you could theoretically create a different profile which uses different sidebar components for different users... but still, the behavior on all tabs will be the same.
It's not a bad idea to have certain components show up for different tabs. I'd suggest throwing that idea on http://ideas.salesforce.com
-Jager
Re: Customizab le Search HTML Components
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-04-2008 03:02 AM
RK wrote:
Wow...this is a great customization.
I do have a question, though.
If I were to add a "City" search box on the new form, is there a way to pass the entered text to two separate parameters in the report.
The reason I ask - we have multiple address records on each of our contacts, and I would like the report to bring back any records with the entered city on any of it's address records.
I realize that I could add multiple "City" search fields, but I don't want my users to have to enter the same city multiple times.
Anyone have any suggestions?
Thanks,
RK
Okay, I appreciate its been _ages_ since you posted your question, RK, but since I came across the same issue and hit upon what looks like a good solution I figured I might as well share...
My solution was to create a formula field called "Full Address Text" which concatenates together all the address fields for all the addresses for (in my case) the person accounts being searched. I added some formatting and blank-line suppression 'cos I'm that kind of perfectionist, but for searching purposes that's not really necessary. All you then need to do is define the concatenated field as your "contains" criterion for the report and Bob's your uncle.
Same trick works well for telephone numbers, by the way.
I hope this helps.
David Sekules
Astadia
Re: Customizab le Search HTML Components - Advanced Search
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-10-2008 01:23 PM - last edited on 11-10-2008 01:26 PM
<FORM action=https://na1.salesforce.com/srch/advsearchresults.jsp—searchType=2& method=get> Search This: <INPUT style="BACKGROUND-COLOR: #ffffa0" name=str> <INPUT class=button type=submit value=Search name=search> </FORM>
Message Edited by BenP on 11-10-2008 01:26 PM
Re: Customizab le Search HTML Components - Advanced Search
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-10-2008 01:49 PM
Are you using a custom report for your search? By the URL in your code it looks like you are just forwarding to the Advanced Search page. Here is the code for the component I created that worked well:
<form action="[put report url here, example: https://na5.salesforce.com/00O7...]" method="get">
Account Name: <br>
<input name="pv0"><br>
Account ID: <br>
<input name="pv1"><br>
Company Name: <br>
<input name="pv2"> <br>
<input class="button" value="Search" name="search" type="submit">
</form>
If you use a report, you need to create the report first then link to it in the component in the first line of the code. In the search I've included you can search by Account Name, Account ID, or Company Name (or any combination thereof). The form puts the inputted text in the first three search criteria fields of the report (in my case the first three fields correspond to the Account Name, Account ID and Company Name respectively) then runs the report. In the report you can specify between 'contains' and 'equals' for each field. I hope this helps.
-Jonathan

