Show records where a field is NULL inside the pop-up window

Hello

I was able to filter records that appear when we click on the “select” button inside a subpanel. It can be done by overriding the $initial_filter value like so:

public function display($widget_data, $additionalFormFields = null, $nonbutton = false)
{

    global $app_strings;
    $initial_filter = '';

    $initial_filter.='&SOME_FIELD='.urlencode("SOMEVALUE");

That initial filter will be used as the $_GET parameter when the pop-up opens up so it will know which records to show

Now the tricky part is i’m trying to figure out how to filter it so it shows records where SOME_FIELD is empty… I tried something like SOME_FIELD=null or SOME_FIELD=false but it doesn’t work… If anyone can suggest anything it would be appreciated.

I don’t know the answer, but it is possible that the filtering code simply does not have that implemented yet. I’ve read other threads where people complain they can’t filter for blanks (from the UI).

If you can follow the course of the code into where it filters it might be easy to add a clause for blanks when it’s building the SQL… this would make an excellent PR :wink:

1 Like

Hey!

Yep sounds like a good idea, I’m pretty sure it’s somewhere within the main SugarView class since the ViewPopup extends it

Speaking of PR I realized that for the abort_delete thing we would need to update the documentation also to explain how it works, let me know if you want me to submit a documentation modification for that.

You’re right, it should be documented, and yes, if you offer to do it I would be quite thankful (once again)

:+1:

1 Like

Got an interesting reply to this question on SO, haven’t tested it but looks promising

1 Like