• stratus
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I need to display a summary of Opportunities by Opportunity Owner in a Visualforce Page Dashboard component. So far I can get it to group by OwnerId, but it doesnt work for Owner.Name. I get the following error: "System.SObjectException: Invalid field Owner.Name for AggregateResult".

 

 

 

public class QuotesRecvd{

    Public String quotecount {get; set;}
    Public String OName {get;set;}
    
    public QuotesRecvd(string n ,string q){     
        this.oName = n;
        this.quotecount = q;
        
    }
}

       public List<QuotesRecvd> QuotesRecvdList = new List<QuotesRecvd>();    
           public List<QuotesRecvd> getQuotesRecvdCount(){
       
              AggregateResult[] agr = [SELECT Owner.Name, count(Name)FROM Opportunity WHERE Quote_Requested__c = :date.today()-1 Group By rollup (Owner.Name)];
           for(AggregateResult qrcvd : agr){
               QuotesRecvdList.add(new QuotesRecvd(String.valueof(qrcvd.get('Owner.Name')),String.valueof(qrcvd.get('expr0'))));
               }
               return QuotesRecvdList;
        
}

 

Any suggestions? I also need to know how to create a test for this.

 

 

Any help would be greatly appreciated!

 

  • June 11, 2011
  • Like
  • 0

Hi,

 

I've a problem with my Batch-Apex.

 

I want to send out Information through a callout. But this Information must send after and after. So I create two Batchjobs (because of two diffrent SOQL and parser-functions) and want to start them in a row.

 

Batch1

- do it´s work

- at finish-functions start Batch2

 

So I started them and ..... Limit Exception. Cannot start a Batch from a Batch.

How can I solve the problem ? I don´t want to write a while-statment and wait till the first job is done to do the next. It is possible to start the second Batch from the first one ? (I don´t want to schedule, or is this the alternative solution for the problem ?)

 

thanks

 

  • June 04, 2010
  • Like
  • 0