Filter Items not showing --All-- or --None--

I'm building list screen to show Cases for a custom entity but for some reason even though the filter box is set as a search screen and attached to the correct list I'm still not getting it to automatically add the --All-- and --None-- options to the selection list in the filter. Am I missing something? I'm trying this on version 7.1 SP2-hotfix.3 S and testing on IE 11 in compatibility mode. Any Help would be much appreciated. I've included my page code below.

<!-- #include file ="..\crmwizard.js" -->
<script src="/AME/CustomPages/DR1.js"></script>
<script src="/AME/CustomPages/AME.js"></script>
<script type="text/javascript">window.attachEvent("onload", JobTopContent);</SCRIPT>
<%
try
{
CRM.SetContext("Find");

if (CRM.Mode<Edit)
{
CRM.Mode = Edit;
}

var sURL=new String( Request.ServerVariables("URL")() + "?" + Request.QueryString );
var myUserId = CRM.GetContextInfo('user','user_userid');
var mySecurity = CRM.GetContextInfo('user','user_territoryprofile');
var myAccountManager = CRM.GetContextInfo('Properties', 'cpro_account_manager');

var intRecordId = new String(Request.Querystring("cpro_PropertiesID"));
var ExtraKeys = '';

if (intRecordId.toString() == 'undefined') {
intRecordId = new String(Request.Querystring("Key58"));
}
var strFilterButton = CRM.Button("filter", "filter.gif", "javascript:document.EntryForm.submit();");
var projectlistBlock = CRM.GetBlock("CaseGrid");
var FilterBoxBlock = CRM.GetBlock("JobWOFilterBox");
// var FilterBoxBlock = CRM.GetBlock("CaseFilterBox");
FilterBoxBlock.ShowSavedSearch=true;
FilterBoxBlock.UseKeyWordSearch=true;

with (FilterBoxBlock)
{
newLine = false;
// AddButton(strFilterButton);
ButtonLocation = Bottom;
ShowSavedSearch=false;
UseKeyWordSearch=false;
}

var Container = CRM.GetBlock("Container");
with (Container)
{
//AddBlock(FilterBoxBlock);
AddBlock(projectlistBlock);
AddBlock(FilterBoxBlock);
DisplayButton(Button_Default) = false;
}

//Make sure fields in filter box are each on new line.
var strArg="";
var myE = new Enumerator(FilterBoxBlock);
while (!myE.atEnd())
{
myEntryBlock = myE.item();
// if (String(Request.Form(myE.item()))=='all')
// {
// strArg+=Request.Form(myE.item());
// }
// else if (String(Request.Form(myE.item()))!='undefined')
if (String(Request.Form(myE.item()))!='undefined')
{
strArg+=" and "+myE.item()+" = '"+Request.Form(myE.item())+"'";
}
myEntryBlock.NewLine = true;
myEntryBlock.AllowBlank = false;
//myEntryBlock.MultipleSelect=true;
//myEntryBlock.RemoveLookUp("--All--");
myE.moveNext();
}

// if (strArg == "all")
// {
// strArg = "";
// }
// else if (strArg == "")
if (strArg == "")
{
strArg += " AND case_status = 'In Progress'";
}
projectlistBlock.ArgObj = "Case_PropertiesId="+intRecordId + strArg;

if (intRecordId.toString() != 'undefined') {
CRM.SetContext("Properties", intRecordId);

if ((true) || (true)) {
//set key values on url so they will be picked up in webpicker
recObj = CRM.FindRecord('Properties','cpro_PropertiesID='+intRecordId);
ExtraKeys = "&Key0=58";
if ((true) && (recObj('cpro_CompanyId') != undefined)) {
ExtraKeys += ExtraKeys + '&Key1='+recObj('cpro_CompanyId');
}
if ((true) && (recObj('cpro_PersonId') != undefined)) {
ExtraKeys += ExtraKeys + '&Key2='+recObj('cpro_PersonId');
}
if ((true) && (recObj('cpro_PropertiesId') != undefined)) {
ExtraKeys += ExtraKeys + '&Key58='+ recObj('cpro_PropertiesId') + '&fieldname=case_propertiesid&fieldval=' + recObj('cpro_PropertiesId');
}

}
if(mySecurity != '15' || (mySecurity == '15' && myAccountManager == myUserId))
{
FilterBoxBlock.AddButton(CRM.Button("New", "new.gif", CRM.URL(282)+ ExtraKeys + "&T=new&E=Properties", 'cases', 'insert'));
}
else if(mySecurity == '15' && myAccountManager != myUserId)
{
CRM.AddContent("You can not view the Work Orders for this Job if you are not assigned as the account manager.");
}
}

projectlistBlock.prevURL=sURL;
CRM.GetCustomEntityTopFrame("Properties");
CRM.AddContent(Container.Execute());
Response.Write(CRM.GetPage());
}
catch(exception)
{
Response.Write("<table class="content"><tr><td colspan=2 class="gridhead"><b>There has been an error</b></td></tr>");
Response.Write("<tr><td class="row1"><b>Error Name:</b></td><td class="row1">" + exception.name + "</td></tr>");
Response.Write("<tr><td class="row2"><b>Error Number:</b></td><td class="row2">" + exception.number + "</td></tr>");
Response.Write("<tr><td class="row1"><b>Error Number:</b></td><td class="row1">" + (exception.number & 0xFFFF) + "</td></tr>");
Response.Write("<tr><td class="row2"><b>Error Description:</b></td><td class="row2">" + exception.description + "</td></tr></table>");
}
finally
{
Response.Write(EndBody);
Response.End();
}
%>

  • 0

    Hi,

    I have checked above issue at my end and found that if you have set Screen Type as “Entry Screen” then “ALL” option will be not available in selection list. To display “ALL” option you have to Set Screen Type as “Search Screen”. But as per your above post you have also configured Screen Type as “Search Screen” so could you please recheck the configuration that you have done and do the Meta Data Refresh for the same.

    Hope this helps!

    Regards,

    Dinesh

  • 0

    Well that helped a little but the problem actually seemed to be that I was using a system list and as per usual they tend to be special and not work like anything else. Here is the correct page code if anybody is interested and thank you Dinesh.

    <%

    try

    {

    var sURL=new String( Request.ServerVariables("URL")() + "?" + Request.QueryString );

    var myUserId = CRM.GetContextInfo('user','user_userid');

    var mySecurity = CRM.GetContextInfo('user','user_territoryprofile');

    var myAccountManager = CRM.GetContextInfo('Properties', 'cpro_account_manager');

    var intRecordId = new String(Request.Querystring("cpro_PropertiesID"));

    var ExtraKeys = '';

    if (intRecordId.toString() == 'undefined') {

    intRecordId = new String(Request.Querystring("Key58"));

    }

    var strFilterButton = CRM.Button("filter", "filter.gif", "javascript:document.EntryForm.submit();");

    var projectlistBlock = CRM.GetBlock("JobWorkOrderList");

    var FilterBoxBlock = CRM.GetBlock("JobWOFilterBox");

    with (FilterBoxBlock)

    {

    newLine = false;

    // AddButton(strFilterButton);

    ButtonLocation = Bottom;

    ShowSavedSearch=false;

    UseKeyWordSearch=false;

    }

    var Container = CRM.GetBlock("Container");

    with (Container)

    {

    AddBlock(projectlistBlock);

    AddBlock(FilterBoxBlock);

    DisplayButton(Button_Default) = false;

    }

    //Make sure fields in filter box are each on new line.

    var strArg="";

    var myE = new Enumerator(FilterBoxBlock);

    while (!myE.atEnd())

    {

    mySearchBlock = myE.item();

    if (String(Request.Form(myE.item()))!='undefined' && String(Request.Form(myE.item()))!='--None--' && String(Request.Form(myE.item()))!='')

    {

    strArg+=" and "+myE.item()+" = '"+Request.Form(myE.item())+"'";

    }

    else if (String(Request.Form(myE.item()))=='')

    {

    strArg+=" and "+myE.item()+" IS NOT NULL";

    }

    else

    {

    strArg+=" and "+myE.item()+" IS NULL";

    }

    mySearchBlock.NewLine = true;

    //mySearchBlock.AllowBlank = false;

    //mySearchBlock.RemoveLookUp("--None--");

    myE.moveNext();

    }

    if (strArg == "")

    {

    strArg += " AND case_status = 'In Progress'";

    }

    projectlistBlock.ArgObj = "Case_PropertiesId="+intRecordId + strArg;

    if (intRecordId.toString() != 'undefined') {

    CRM.SetContext("Properties", intRecordId);

    if ((true) || (true)) {

    //set key values on url so they will be picked up in webpicker

    recObj = CRM.FindRecord('Properties','cpro_PropertiesID='+intRecordId);

    ExtraKeys = "&Key0=58";

    if ((true) && (recObj('cpro_CompanyId') != undefined)) {

    ExtraKeys += ExtraKeys + '&Key1='+recObj('cpro_CompanyId');

    }

    if ((true) && (recObj('cpro_PersonId') != undefined)) {

    ExtraKeys += ExtraKeys + '&Key2='+recObj('cpro_PersonId');

    }

    if ((true) && (recObj('cpro_PropertiesId') != undefined)) {

    ExtraKeys += ExtraKeys + '&Key58='+ recObj('cpro_PropertiesId') + '&fieldname=case_propertiesid&fieldval=' + recObj('cpro_PropertiesId');

    }

    }

    if(mySecurity != '15' || (mySecurity == '15' && myAccountManager == myUserId))

    {

    FilterBoxBlock.AddButton(CRM.Button("New", "new.gif", CRM.URL(282)+ ExtraKeys + "&T=new&E=Properties", 'cases', 'insert'));

    }

    else if(mySecurity == '15' && myAccountManager != myUserId)

    {

    CRM.AddContent("You can not view the Work Orders for this Job if you are not assigned as the account manager.");

    }

    }

    projectlistBlock.prevURL=sURL;

    CRM.GetCustomEntityTopFrame("Properties");

    CRM.AddContent(Container.Execute());

    Response.Write(CRM.GetPage());

    }

    catch(exception)

    {

    Response.Write("

    ");
    There has been an error

    Response.Write("

    ");
    Error Name:" + exception.name + "

    Response.Write("

    ");
    Error Number:" + exception.number + "

    Response.Write("

    ");
    Error Number:" + (exception.number & 0xFFFF) + "

    Response.Write("

    Error Description:" + exception.description + "
    ");

    }

    finally

    {

    Response.Write(EndBody);

    Response.End();

    }

    %>