This is more of an architectural question. I am trying to build a filter function similar to what Salesforce has whereby I click an Add filter button and this displays a drop down. Based on the choice of the first drop down, I dynamically add the second(operator values) and third (third value for my query) drop down with related values. Once the user clicks OK button, the filter executes.

My initial solution: I started off using Javascript to build the dependent picklist as well as grabbing the user selected data and built it into one string for use as part of my query at the back end. Using hidden input field and actionfunction, I was able to retrieve the string in my apex code and then using dynamic soql I was able to query and filter.

For scalability and optimization reasons I believe a pure visualforce and apex way of doing this will be a better way for me to go. However I am not quite sure how. Could anyone provide a suggestion? Thanks


Use schema describes to get objects, fields and field types, and a vf page to gather filter criteria. Then combine all the filters using a 'rule 1 AND rule 2 OR rule 3' etc like the standard report builder to create a dynamic soql query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.