Monday, February 3, 2014

Advanced Search using SOSL and SOQL in salesforce


1.1      Background


Ø  Using a combination of SOSL, dynamicly built SOQL and javascript calls, build an intuitive, fast search utitlity based on the provided custom object and requirements below.  The object metadata and sample data are included in the Assets  section.  Here's an unmanaged package as well.

Ø  The emphasis should be on a solid Visualforce+Javascript+Apex approach.  Visual appeal is NOT a concern, as long as the layout is roughly based on the attached wireframe.

Ø  Search box should perform a SOSL text search against these fields: Business_Need_Mktg__c and Appirio_Solution_Mktg__c

Ø  Left side filter (checkbox) should filter results where Integrations__c contains "Cast Iron"

Ø  Page should follow the basic layout shown in the attached wireframe

Ø  Solution should be entirely native to the force.com platform (no iFramed components) but may use javascript frameworks such as Angular.js, Backbone.js, jQuery UI, etc.

Ø  Total number of results should be displayed after each search (see wireframe)

Ø  The solution does not need to be "production ready" but should be organized cleanly, in a manner easy to build upon




1.2     Solution approach

I have provided two search capability
1) SOSL
2) SOQL
Ø  To achieve this I have given two checkboxes on UI. By default SOSL search will be selected.

Ø  To show the search results I have used datatable so that filtering on the searched result comes automatically.

Ø  To make the response faster I have used VF remoting and build the page on runtime using DOM update


Ø  The left panel checkbox filter can be added any point of time . i.e. before or after search

Ø  I have made the readonly attribute true so that page can show more records


Ø  I have used for loop SOQL which use query more . It gives the application better stability during SOQL search

Ø  I have given all the checkboxes instead of only one checkbox to the UI. I have used schema.getGlobalDescribe to get the picklist values dynamically


Ø  I have also formatted the search result for better readability. i.e. by removing semicolon form multi select pick list


2.0     Advanced Search


2.1      Advanced Search


2.1.1     Visualforce page

Serial No
 Name
Description
1.      
AdvancedSearch
Page to search the custom object and show the results

2.1.2     Apex Class

Serial No
Name
Description
1.      
AdvancedSearchController
Controller for the VF page AdvancedSearch . Will do the backend (server side search) and send the response to the page
2.      
TEST_ AdvancedSearchController
Test class for AdvancedSearchController APEX class

3.0     Static Resource

Serial No.
Name
Description
1.      
BootStrap
Will contains the library for bootstrap. Has been used to provide the slick and fast UI
2.      
DataTables
Will contains the library for datatable. Has been used to provide the slick and fast UI with searching, sorting and pagination
3.      
TABJQuery
Will contains the library for JQuery. Has been used to provide the slick and fast UI with datatable & bootstrap


1.0    Application Video

2.0    Unmanaged Package