You need to sign in to do that
Don't have an account?
Gary Payne 9
Need help with an Apex Controller Class
We have an Apex Class Controller that needs to be altered to prevent Cases with a Type field value of "Project" from being included in the view. Following is our Apex Class code:
public with sharing class ANICasesListViewController
{
public String all_cases_list_view {get;set;}
public String customer_service_list_view {get;set;}
public String technical_support_list_view {get;set;}
private Static String ALL_CASES = 'All Cases';
private Static String CustomerService_CASES = 'Customer Service';
private Static String TechnicalSupport_CASES = 'Technical Support';
public ANICasesListViewController(ApexPages.StandardSetController controller) {
String case_query = 'SELECT Id FROM Case LIMIT 1';
all_cases_list_view = getListView( case_query , ALL_CASES );
customer_service_list_view = getListView( case_query , CustomerService_CASES );
technical_support_list_view = getListView( case_query ,TechnicalSupport_CASES );
}
public static String getListView( String casequery, String listviewname )
{
String listviewid = null;
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator(casequery));
List<SelectOption> listViewsAll = ssc.getListViewOptions();
for (SelectOption so : listViewsAll)
{
if (so.getValue() == listviewname )
{
listviewid = so.getValue();
break;
}
}
if( listviewid != null )
{
// for some reason, won't work with 18 digit ID
listviewid = listviewid.substring(0,15);
}
return listviewid;
}
}
Where in this code can the Type field value of "Project" be eliminated from the view and what would the code be? Any help is greatly appreciated.
public with sharing class ANICasesListViewController
{
public String all_cases_list_view {get;set;}
public String customer_service_list_view {get;set;}
public String technical_support_list_view {get;set;}
private Static String ALL_CASES = 'All Cases';
private Static String CustomerService_CASES = 'Customer Service';
private Static String TechnicalSupport_CASES = 'Technical Support';
public ANICasesListViewController(ApexPages.StandardSetController controller) {
String case_query = 'SELECT Id FROM Case LIMIT 1';
all_cases_list_view = getListView( case_query , ALL_CASES );
customer_service_list_view = getListView( case_query , CustomerService_CASES );
technical_support_list_view = getListView( case_query ,TechnicalSupport_CASES );
}
public static String getListView( String casequery, String listviewname )
{
String listviewid = null;
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator(casequery));
List<SelectOption> listViewsAll = ssc.getListViewOptions();
for (SelectOption so : listViewsAll)
{
if (so.getValue() == listviewname )
{
listviewid = so.getValue();
break;
}
}
if( listviewid != null )
{
// for some reason, won't work with 18 digit ID
listviewid = listviewid.substring(0,15);
}
return listviewid;
}
}
Where in this code can the Type field value of "Project" be eliminated from the view and what would the code be? Any help is greatly appreciated.
'SELECT Id FROM Case Where Type != 'Project' LIMIT 1';
All Answers
'SELECT Id FROM Case Where Type != 'Project' LIMIT 1';
4010 Boy Scout Blvd. Suite 900
Tampa, FL 33607 P 813.580.5603 | C 714.474.5915 abilitynetwork.com