Advanced Search – Nested Criteria

Recently we finished a major refactor of the search mechanism.  This provides a critical foundational piece on our way to building a reporting module.  One of the special features of the new searching is the ability to search unlimited relationships.  For example, from the account list view you could search related contact’s opportunities.  Here is an image showing the contact listview and how you can search by related account name.

Here is the code in ContactsSearchView that is relevant:

$metadata = array(
     'global' => array(
          'definedNestedAttributes' => array(
                array('account' => array(
                    'name',
                )),
           ),

If you want to add so in contacts you can search related account’s opportunities names, you could do this

$metadata = array(
'global' => array(
      'definedNestedAttributes' => array(
      array('account' => array(
            'name',
             array('opportunities' => array(
                   'name'
                  ),
             )
      )),
),

Hopefully this can help you out.

Leave a Comment

  • Nick Kouzos

    Can you post a tutorial for using search operators?I managed to use only “AND” and “OR”, “NOT” doesn’t work.Thank You :)

    • Ray Stoeckicht

      Correct, it only works with ‘and’ and ‘or’. ‘Not’ does not work.

      • Matthias Schmitz

        is there something new about the Searchoperator »NOT«?