• pranav prashant 10
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies

I've discovered that when using the following object I get some strange behavior, and I'm wondering if anyone can point out what I'm doing wrong??

 

The following setup returns the campaigns list correctly filtered by the paramters in the associated FilterId for the 'Campaign' object but the orderby clause is invalidated and the campaigns are sorted by the 'last selection on the standard list view vf component' under the default campaigns tab, so ordered by 'Name' or 'Type' or whatever...not 'StartDate ASC' as set.

ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC]));
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 The following setup returns the campaigns list correctly sorted using the ORDER BY clause, but they are not FILTERED by the associated listview filterid using 'setFilterId('...')'

List<Campaign> campaigns = [SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(campaigns);
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 

What am I missing about ordering these campaigns correctly...

I've discovered that when using the following object I get some strange behavior, and I'm wondering if anyone can point out what I'm doing wrong??

 

The following setup returns the campaigns list correctly filtered by the paramters in the associated FilterId for the 'Campaign' object but the orderby clause is invalidated and the campaigns are sorted by the 'last selection on the standard list view vf component' under the default campaigns tab, so ordered by 'Name' or 'Type' or whatever...not 'StartDate ASC' as set.

ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC]));
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 The following setup returns the campaigns list correctly sorted using the ORDER BY clause, but they are not FILTERED by the associated listview filterid using 'setFilterId('...')'

List<Campaign> campaigns = [SELECT Id, Name, StartDate, EndDate, Type, Status, Description, Owner.Name,NumberOfLeads, NumberOfContacts, NumberOfOpportunities, NumberOfWonOpportunities,AmountAllOpportunities, Exclude_from_Calendar__c FROM Campaign ORDER BY StartDate ASC];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(campaigns);
ssc.setFilterID(this.filterId);
ssc.setPageSize(2000);
// use standardset controller to limit results by listview
List <Campaign> campaignObjects = ssc.getRecords();	

 

What am I missing about ordering these campaigns correctly...