SugarCRM Popup Filter on Relate/Relationship field

SugarCRM Popup Filter by Techaroha Team

Applying filter in SugarCRM on the pop-up view results of a relate/relationship field.

Why SugarCRM PopUp Filter?

While working in SugarCRM, many times we get the unnecessary records in relate field pop up view.

Sometimes, we have to filter the records manually as per our need.

It’s better to filter those records at the back-end as per system requirement and get the relevant records only.

So avoiding hectic job of manual searching. Let’s see how SugarCRM PopuP Filter is being implemented.

How ?

It’s simple, here is the answer.

For example, Add a filter in Account pop up view on

From the SugarCRM  Admin Panel, accessing the Studio or Module Builder, we can add the fields in the pop up the search.

Suppose we want to add a field Industry in search fields of Accounts module pop up view.

Step 1.   Go to the admin panel.

Step 2.  Go to the studio.

Step 3.  Select the module Accounts.

Step 4.  Select “Layouts” option.

Step 5.  Select “Pop-up view”.

Step 6.  Select “Popup Search”.

Step 7.  Drag the field “Industry” from the column Hidden and drop in “Default” column.

This is how anyone can add the fields in the pop up the search as per the requirements.

Going further now we want to use that field to filter the records in the pop view.

Only the records having Industry as “Consulting” should be listed in the pop-up view.

To perform this functionality at the back-end,  we have to work on the pop-up view of Accounts module.

As per the standard practice, we will do it in “Custom/modules/Accounts/views/” directory.

In views folder, you can see the file “view.popup.php”. If it is not there, create a PHP file with the same name.

If you create a new file add the code given below:

require_once (‘include/MVC/View/views/view.popup.php’);

class AccountsViewPopup extends ViewPopup

{

function CustomViewPopup()

{

parent::ViewPopup();

}

function display()

{

global $popupMeta, $mod_strings, $custom_filter_gcm;

parent::display();

}

}

Now to apply the filter we add some lines of code in the display function.

require_once (‘include/MVC/View/views/view.popup.php’);

class AccountsViewPopup extends ViewPopup
{

function CustomViewPopup()
{
parent::ViewPopup();
}

function display()
{
global $popupMeta, $mod_strings, $custom_filter_gcm;

/* We post the industry value as “Consulting” in an array. */

$_REQUEST[‘industry_advanced’] = array(‘Consulting’);

parent::display();
}
}

If we observe the pop view of Accounts module, we will get records of Industry “Consulting”.

And we are done.  It’s that simple.

If you have any such requirement and detail implementation help you can always contact us here.

Facebook Comments
Author:
PHP and SugarCRM Developer @ Techaroha Solutions Private Limited, always ready to learn and explore new possibilities in technology.
Comments
  • Fantastic site. Lots of useful information here. I am sending it to some friends ans also sharing in delicious. And naturally, thanks for your effort!

  • I was pretty pleased to locate this web page. I wanted to thanks for your time for this superb read!! I definitely enjoying each and every little bit of it and I have you bookmarked to have a look at new stuff you weblog post.

  • I will immediately seize your rss feed as I can’t find your email subscription link or e-newsletter service. Do you have any? Kindly let me recognize so that I may just subscribe. Thanks.

  • Wow, awesome blog format! How lengthy have you ever been blogging for? you make blogging look easy. The full glance of your website is wonderful, as smartly as the content!

  • Pingback: Google

Leave a Reply

Show Buttons
Hide Buttons