• Puneet Khosla
  • NEWBIE
  • 88 Points
  • Member since 2015
  • Deloitte

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 21
    Replies
Is there a way where I can re-calculate roll up summary field value for 1 particular master record (rather than force recalculation) through apex / api / etc.?
I have a problem where my roll up summary fields are not getting calculated properly (infact even after deleting all detail records, roll up summary field has values which is weird.

This is not impacting entire org, but only a few records.

I have tried deleting, inserting , updating records but no luck.
I am getting this error when trying to do the "Lightning Experience Rollout Specialist"

The AccountTab Visualforce page does not include one or both of the following: the apex:slds tag in the page, or the slds-table value in the table.


My code is as follows:
 
<apex:page standardStylesheets="false" standardController="Account" recordSetVar="accounts" tabStyle="account" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
   <head>
       <apex:slds />
    </head> 
	<body>
    <div class="slds-scope">     
        <table class="slds-table">
  			<thead>
    			<tr class="slds-text-title_caps">
      				<th scope="col">
        				<div class="slds-truncate" title="{!$ObjectType.Account.Fields.Name.Label}">{!$ObjectType.Account.Fields.Name.Label}</div>
      				</th>
    			</tr>
  			</thead>
  			<tbody>
    			<apex:repeat value="{!accounts}" var="a">
                <tr>
                  <td data-label="Account Name">
                    <div class="slds-truncate" ><apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink></div>
                  </td>
      
    			</tr>
                </apex:repeat>
            </tbody>
        </table>
     <!--   
     <div class="slds-scope">
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accounts}" var="a" styleClass="slds">
                <apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}">
                    <apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>-->
    </div>
        </body>
</apex:page>

 
When you do a load through data loader or using Database.insert (or update) using false as a parameter, then ideally it should allow successful records to save and error records to give an error. Though this is happening, however I observed that recently its taking 2 iterations to save and not one if there is a record in the batch with a missing required field data, thus resulting in triggers, workflows, validations , etc. to run twice.
 
What's worse is CPU usage is not reset in 2nd iteration though SOQL limits are getting reset. Thus resulting in almost double overall CPU and leading to CPU timeouts.
 
If we put a recursion control, then the data that gets saved without trigger processing for the 2nd time, causing data quality issues.
 
Is this a bug or it was there before or do we need to do something in the code to ensure that records are saved in first time?
 
To replicate this.
Create a new custom object (Call it Dummy Object)
Make 2-3 custom text fields (Name1, Name2, Name3) , out of which Name 2 is a required field
Write a trigger
Before Insert – Make Name3 = Name 2
After Insert – Print in Debug logs My name is <Name 3>
Load 3 records first through data loader(batch size 200 with no bulk API) and Anonymous (using Database.insert false) with the following condition
1st  record has Name 1 as ABC and Name 2 as DEF.
2nd record has no value in Name 1 and Name 2
3rd record has XYZ in Name 2
If you open Debug  logs, you will see 2 iterations. If you stop the iteration through recursion control, Name 3 is not populated in records.
I have a http request (to an external system) which is returning a valid json response when I put it in browser, but when I try to use the http request from code, it doesn't work.

It further looks that when it returns, its actually taking to the salesforce Remote Authorization page, thus causing a redirect.

Is there are way to proceed further when this Redirect Authorization page is coming in apex or what do I need to pass in the http request (I added the Header Authorization : 'OAuth' + UserSessionid in the request from salesforce to the api.

Debug statement of Response.getBody();
==
if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('https://test.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3Dsdjfnsdjkfbjsdfbsdbfsdjhbfhsdbf'); }  else
if (window.location.replace){ 
window.location.replace('https://test.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3D.............
==
I am able to send emails from Apex code, however it is only saved in Activity history of Case (object in setWhatId) if I set the TargetObjectId.

My requirement is that I might / might not want to send the email to TargetObjectId, so I have made use of ToAddress.
This however doesn't save the Activity history (or basically create a task as completed + save email message) & if I also include TargetObjectId, it will save the email as Activity history, however I donot want to include TargetObjectId.

In Winter16 there is a feature treatTargetObjectAsRecipient which when set to false won't send the email to TargetObjectId (which is what I wanted), but it is also not saving the Activity History.

So is there a way, where I can Save the email in the Activity History + provide ability to avoid email being sent to the TargetObjectId, but send it to other email addresses mentioned on my page in ToAddress field (which may or may not contain the contact being used as TargetObjectId).

I don't want to create a Contact , send Email and then delete contact.
The problem is in a webtab (or apex:iframe) I am opening a site that sits behind a firewall.
I am able to configure the router to add the Salesforce IP address range, however Salesforce iframe sends the request to the external site (behind the firewall) using user's IP address and not salesforce IP address range.

Is there a way to send the IP address of Salesforce or any other option that we can use open the external site from within salesforce
I am getting the following error when trying to change the WhoId of an event (Shared Activities is turned on).
The update is happening from a Custom Visualforce Page and Apex Class.
Input field for whoId is used in the Visualforce Page and class uses and upsert.

Upsert failed. First exception on row 0 with id 00U25000001XYDWEA4; first error: INVALID_CROSS_REFERENCE_KEY, Updating the whoId fields for shared activities is not allowed.: [WhoId]

Is there a way to update the who Id from a custom Apex / VF page when Shared Activities is switched on?

There is a trigger on Event but that is not creating any Event Relation records
I am getting this error when trying to do the "Lightning Experience Rollout Specialist"

The AccountTab Visualforce page does not include one or both of the following: the apex:slds tag in the page, or the slds-table value in the table.


My code is as follows:
 
<apex:page standardStylesheets="false" standardController="Account" recordSetVar="accounts" tabStyle="account" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
   <head>
       <apex:slds />
    </head> 
	<body>
    <div class="slds-scope">     
        <table class="slds-table">
  			<thead>
    			<tr class="slds-text-title_caps">
      				<th scope="col">
        				<div class="slds-truncate" title="{!$ObjectType.Account.Fields.Name.Label}">{!$ObjectType.Account.Fields.Name.Label}</div>
      				</th>
    			</tr>
  			</thead>
  			<tbody>
    			<apex:repeat value="{!accounts}" var="a">
                <tr>
                  <td data-label="Account Name">
                    <div class="slds-truncate" ><apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink></div>
                  </td>
      
    			</tr>
                </apex:repeat>
            </tbody>
        </table>
     <!--   
     <div class="slds-scope">
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accounts}" var="a" styleClass="slds">
                <apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}">
                    <apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>-->
    </div>
        </body>
</apex:page>

 
I am looking to override the Delete button and link on both the contact and lead objects.  Can anyone help me with the Visualforce page and controller class?  
Hi there,

I got the following error on this badge
https://trailhead.salesforce.com/trails/learn-admin-essentials/projects/prioritize-leads-with-einstein-lead-scoring/steps/configure-einstein-lead-scoring

We can't find 'Sales Cloud Einstein Permission Set' assigned to 'Pepper Belle' and 'User Admin'

I have already assign user Pepper Belle and me to permission set.
Any idea to solve it?

Thanks in advance.

Regards,
LinThaw
Hi Everyone!

When trying to veryfy the first challenge in "Upload Flag Images into Salesforce Analytics" I am receiving the following error,

Challenge Not yet complete... here's what's wrong: 
Could not find 'Analytics Cloud Platform' licenses. Please check instructions to login to Wave enabled org.

This is a brand new org. and setup as outlined on the trail.
The org. is connected and lunched - I have repeated this multiple times.

Permission Set Licenses

The error is talking about "Analytics Cloud Platform" licenses which indeed do not exist the licenses available here are "Analytics Cloud Explorer & Analytics Platform" which are Permission Set Licenses.

Any useful suggestion here is highly appricated.
Im getting the following error, even though i am able to dynamically navigate to the report with filters by clicking on a link on the campaign page. 

filters with blank values so they can be passed in dynamically:
User-added image

my dynamic URL: 
/one/one.app#/sObject/00O1I000000gMcTUAU/view?&fv0={!Campaign.Name}&fv1={!Campaign.Id}
User-added image

The result from clicking on the link:
User-added image

and the error: 
Challenge Not yet complete... here's what's wrong: 
The View Lightning Campaign Influence Report link on the Campaign object must use a relative URL and dynamic filter values.
 
"Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: HEMGXMGK"

Is anyone else getting this error for step 7 when creating the report?
I am getting this error when trying to do the "Lightning Experience Rollout Specialist"

The AccountTab Visualforce page does not include one or both of the following: the apex:slds tag in the page, or the slds-table value in the table.


My code is as follows:
 
<apex:page standardStylesheets="false" standardController="Account" recordSetVar="accounts" tabStyle="account" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
   <head>
       <apex:slds />
    </head> 
	<body>
    <div class="slds-scope">     
        <table class="slds-table">
  			<thead>
    			<tr class="slds-text-title_caps">
      				<th scope="col">
        				<div class="slds-truncate" title="{!$ObjectType.Account.Fields.Name.Label}">{!$ObjectType.Account.Fields.Name.Label}</div>
      				</th>
    			</tr>
  			</thead>
  			<tbody>
    			<apex:repeat value="{!accounts}" var="a">
                <tr>
                  <td data-label="Account Name">
                    <div class="slds-truncate" ><apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink></div>
                  </td>
      
    			</tr>
                </apex:repeat>
            </tbody>
        </table>
     <!--   
     <div class="slds-scope">
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accounts}" var="a" styleClass="slds">
                <apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}">
                    <apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>-->
    </div>
        </body>
</apex:page>

 
Hello ,

I am currently working through the Lightning Rollout Superbadge and have hit a stump on the enhance account record pages 
error

User-added image

I updated both the account and account sales layout with the appropriate fields highlighted and assigned them to Custom Sales Team Profile and Standard user profile yet I am still getting this error.

Do I need to create a sales rep profile when there is already a Custom Sales Profile created ? What other errors could be causing this. Not looking for the answer but any general direction would be greatly appreciated ! Also, for Paloma's page would her page assignment just be set to Standard Platform user ? 

Second question. Is the Key Sales Data page built using Lightning app builder ?

Thank you for help. 
I have a http request (to an external system) which is returning a valid json response when I put it in browser, but when I try to use the http request from code, it doesn't work.

It further looks that when it returns, its actually taking to the salesforce Remote Authorization page, thus causing a redirect.

Is there are way to proceed further when this Redirect Authorization page is coming in apex or what do I need to pass in the http request (I added the Header Authorization : 'OAuth' + UserSessionid in the request from salesforce to the api.

Debug statement of Response.getBody();
==
if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('https://test.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3Dsdjfnsdjkfbjsdfbsdbfsdjhbfhsdbf'); }  else
if (window.location.replace){ 
window.location.replace('https://test.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3D.............
==
Hi,

I am new to Apex and visualforce and having ago!

I have managed to create a small visualforce page to show charts on my projects page which filters fine using the following code (section of): -
<apex:page StandardController="pse__Proj__c">
   <apex:pageblock >
        <apex:pageblockSection columns="4">
               <analytics:reportChart reportId="00OJ0000000hi2k" 
                    filter="{column:'pse__Proj__c.Name', operator:'equals', value:'{!pse__Proj__c.Name}'}" size="small">
        </analytics:reportChart>

When I click on this it opens the report within the small visualforce section and I would like this chart, when clicked to open in a new window, or even in a new tab.

Do I need a controller for this or is it simple code like open.window...parent etc ...
Thanks

Me
  • February 05, 2016
  • Like
  • 1
Hi

I'm going through the Developer Begin Trail, but I'm facing some issues to get the Developer Console to show up the right code coverage (Winter '16).
I tried many of the suggestions out there like uncheck the "Test/Always test run async", uncheck the "Store Only Aggregated Code Coverage", run from the BUILD section... nothing seems to work (and I'm pretty sure I'm covering at least some lines of code...)

The Class I'm testing is the one provided by Salesforce guys:
public class VerifyDate {
	
	//method to handle potential checks against two dates
	public static Date CheckDates(Date date1, Date date2) {
		//if date2 is within the next 30 days of date1, use date2.  Otherwise use the end of the month
		if(DateWithin30Days(date1,date2)) {
			return date2;
		} else {
			return SetEndOfMonthDate(date1);
		}
	}
	
	//method to check if date2 is within the next 30 days of date1
	private static Boolean DateWithin30Days(Date date1, Date date2) {
		//check for date2 being in the past
        	if( date2 < date1) { return false; }
        
        	//check that date2 is within (>=) 30 days of date1
        	Date date30Days = date1.addDays(30); //create a date 30 days away from date1
		if( date2 >= date30Days ) { return false; }
		else { return true; }
	}

	//method to return the end of the month of a given date
	private static Date SetEndOfMonthDate(Date date1) {
		Integer totalDays = Date.daysInMonth(date1.year(), date1.month());
		Date lastDay = Date.newInstance(date1.year(), date1.month(), totalDays);
		return lastDay;
	}
}
and my Test Class looks as follow:
 
@isTest
private class TestVerifyDate {
    @isTest static void checkDatesWithin30Days(){
        Date dt1 = date.today();
        Date dt2 = dt1.addDays(15);
        Date dte = VerifyDate.CheckDates(dt1, dt2);
        System.assertEquals(dt2, dte);
    }
    
    @isTest static void checkDatesDate2BeforeDate1(){
        Date dt1 = date.today();
        Date dt2 =	 dt1.addDays(-15);
        Date dte = VerifyDate.CheckDates(dt1, dt2);
        
        //Get the last day of dt1 month
        Integer totalDays = Date.daysInMonth(dt2.year(), dt2.month());
		Date lastDay = Date.newInstance(dt2.year(), dt2.month(), totalDays);
		Date assertDate = lastDay;
        
        System.assertEquals(assertDate, dte);
    }
    
    @isTest static void checkDatesNotWithin30Days(){
        Date dt1 = date.today();
        Date dt2 =	 dt1.addDays(45);
        Date dte = VerifyDate.CheckDates(dt1, dt2);
        
        //Get the last day of dt1 month
        Integer totalDays = Date.daysInMonth(dt1.year(), dt1.month());
		Date lastDay = Date.newInstance(dt1.year(), dt1.month(), totalDays);
		Date assertDate = lastDay;
        
        System.assertEquals(assertDate, dte);
    }

}

No matter what I do, the Code Coverage is always 0% (the code coverage for the test classes in the examples, copy and pasting.... is also 0%)
Anyone giving me some help on this?
Thanks!!


 
Hi,
how to display selected country account in visualforce.

Here country's are in picklist when i am selecting the country display to the account's in picklist (country based account ) and click the submit button now display the account based contact details 

Thanks
 
  • October 28, 2015
  • Like
  • 0
Hi,

I have crated a table. I used html tags for alignment. It is not showing table row with 3 columns. I am not able to find the mistake. Please help me.
<table>
    <tr>
    <th><font size="2px" color="#6A7A8B">CITY/TOWN<font color="red">*</font></font></th>
    <th><font size="2px" color="#6A7A8B">COUNTY/PROVINCE<font color="red">*</font></font></th>
    <th><font size="2px" color="#6A7A8B">ZIP/POSTAL CODE</font></th>
  </tr>
  <tr><td><apex:inputField label="" value="{!Lead.City}" style="width: 100px; font: 10px Verdana, Geneva, sans-serif;height: 30px;" /></td>
     <td><apex:inputField label="" value="{!Lead.Country}" style="width: 100px; font: 10px Verdana, Geneva, sans-serif;height: 30px;"/></td>
    <td><apex:inputField label="" value="{!Lead.PostalCode}" style="width: 100px; font: 10px Verdana, Geneva, sans-serif;height: 30px;"/>
    </td></tr>
    </table>

      </apex:pageBlockSection>
      </apex:outputPanel>
 <table>

 
I am getting the following error when trying to change the WhoId of an event (Shared Activities is turned on).
The update is happening from a Custom Visualforce Page and Apex Class.
Input field for whoId is used in the Visualforce Page and class uses and upsert.

Upsert failed. First exception on row 0 with id 00U25000001XYDWEA4; first error: INVALID_CROSS_REFERENCE_KEY, Updating the whoId fields for shared activities is not allowed.: [WhoId]

Is there a way to update the who Id from a custom Apex / VF page when Shared Activities is switched on?

There is a trigger on Event but that is not creating any Event Relation records
Hi,

 Creating a Task with more than one contacts associated with it.
Written a after insert trigger on Task and trying to get TaskWhoRelations for that task but it is giving only one Contact.

User-added image

 
trigger TaskTrigger on Task (after insert) {

List<Task> tasks=[Select WhoId, WhatId, (Select Id, RelationId, TaskId From TaskWhoRelations) From Task where id  IN : Trigger.NewMap.keySet()];

for(Task t:tasks)
{

System.debug('################'+t.TaskWhoRelations);
System.debug('################'+t.TaskWhoRelations.size());
}

}



**Any help is really appreaciated. 
Thanks in advance.


Thanks,
Naveen.
My Controller:
global class AR_RepWorkingReport {
        //public Map<ID,User> reps;
        //
        //
        //DeclinedLeads: Invoice Status='Lead Refunded'
        //AcceptedLeads: Invoice Status='Lead Sold/Charged'
    public List<User> repsList;
    public String selectedRep{get;set;}
    public String startdate{get;set;}
    public String enddate{get;set;}
    public repstats statistics{get;set;}
    public List<clients> clientscount{get;set;}
    public List<PieWedgeData> ActivitiesPieData{get;set;}
    public List<PieWedgeData> ClientsPieData{get;set;}
    public boolean renderPie{get;set;}
    public AR_RepWorkingReport()
    {
        repsList=[select ID,Name from User where isActive=true and type_rep__c in ('Junior','Senior') order by Name ];
        statistics=new repstats();
        clientscount =new  List<clients>();  
        ActivitiesPieData=new List<PieWedgeData>();
        ClientsPieData=new List<PieWedgeData>();
        renderPie=false;
    }
    public List<PieWedgeData> getAcPieData()
    {
        return ActivitiesPieData;
    }
    public List<PieWedgeData> getclPieData()
    {
        return ClientsPieData;
    }
    public class PieWedgeData {
        public String name { get; set; }
        public Integer data { get; set; }
        public PieWedgeData(String name, Integer data) {
            this.name = name;
            this.data = data;
        }
    }
     public void getClientsPieData() {
        ClientsPieData = new List<PieWedgeData>();
        //List<PieWedgeData> clientsPie = new List<PieWedgeData>();
                For(clients c : clientscount)
        {
            if(Integer.valueOf(c.count)!=0){
                String chartclientName=c.Name==null?'None':C.name;
                ClientsPieData.add(new PieWedgeData(chartclientName, Integer.valueOf(c.count)));}
        }
    } 
    
    
    public void getActivitiesPieData() {
        ActivitiesPieData = new List<PieWedgeData>();
        //List<PieWedgeData> clientsPie = new List<PieWedgeData>();
        if(Integer.valueOf(statistics.voiceMail)!=0){
        ActivitiesPieData.add(new PieWedgeData('Voice Mail', Integer.valueOf(statistics.voiceMail)));
        }
        if(Integer.valueOf(statistics.ConversationCSuite)!=0){
        ActivitiesPieData.add(new PieWedgeData('Conversation with C Suite', Integer.valueOf(statistics.ConversationCSuite)));
        }
        if(Integer.valueOf(statistics.ConversationHR)!=0){
        ActivitiesPieData.add(new PieWedgeData('Conversation with HR', Integer.valueOf(statistics.ConversationHR)));
        }
        if(Integer.valueOf(statistics.ConversationOther)!=0){
        ActivitiesPieData.add(new PieWedgeData('Conversation - Other', Integer.valueOf(statistics.ConversationOther)));
        }
        if(Integer.valueOf(statistics.NML)!=0){
        ActivitiesPieData.add(new PieWedgeData('No Message Left', Integer.valueOf(statistics.NML)));
        }
        if(Integer.valueOf(statistics.FollowUpReminder)!=0){
        ActivitiesPieData.add(new PieWedgeData('Follow Up Reminder', Integer.valueOf(statistics.FollowUpReminder)));
        }
        if(Integer.valueOf(statistics.AcceptedLeads)!=0){
         ActivitiesPieData.add(new PieWedgeData('Accepted Leads', Integer.valueOf(statistics.AcceptedLeads)));
        }
        if(Integer.valueOf(statistics.DeclinedLeads)!=0){
         ActivitiesPieData.add(new PieWedgeData('Declined Leads', Integer.valueOf(statistics.DeclinedLeads)));
        }
        if(Integer.valueOf(statistics.RFI)!=0){
         ActivitiesPieData.add(new PieWedgeData('RFI', Integer.valueOf(statistics.RFI)));
        }
    } 
    /*
    public void getActivitiesPieData() {
        ActivitiesPieData = new List<PieWedgeData>();
        //List<PieWedgeData> clientsPie = new List<PieWedgeData>();
        ActivitiesPieData.add(new PieWedgeData('Voice Mail', 1));
        ActivitiesPieData.add(new PieWedgeData('Conversation with C Suite',2));
        ActivitiesPieData.add(new PieWedgeData('Conversation with HR', 3));
        ActivitiesPieData.add(new PieWedgeData('Conversation - Other',4));
        ActivitiesPieData.add(new PieWedgeData('No Message Left',5));
        ActivitiesPieData.add(new PieWedgeData('Follow Up Reminder', 6));
         ActivitiesPieData.add(new PieWedgeData('Accepted Leads', 7));
         ActivitiesPieData.add(new PieWedgeData('Declined Leads', 8));
         ActivitiesPieData.add(new PieWedgeData('RFI', 9));
    } */
    
    
    
    public void fetchRepBehaviors()
    {
        
        statistics=new repstats(); 
        clientscount =new  List<clients>();
        Map<String,integer> clientsmp=new Map<String,integer>();
        if(startdate!=null&&enddate!=null&&selectedRep!=null){
            Date statsstart=date.parse(startdate);
            Date statsend=date.parse(enddate);
            
            List<Task> repTasks=[select CallType__c,Contact_Type__c,whatId from Task where OwnerId=:selectedRep and createddate>=:statsstart and createddate<=:statsend];
            //IDs of Prospects
            List<ID> whatids=new LIst<ID>();
            List<Opportunity> repopps=[select Opportunity_Type__c,Opportunity_stage__c,Invoice_Status__c from Opportunity where (OwnerId=:selectedRep or Lead_sharing__c=:selectedRep) and createddate>=:statsstart and createddate<=:statsend];
           
            statistics.totalActivities=repTasks.size();
            System.debug('Number of Tasks: '+repTasks.size());
            for(Task t : repTasks)
            {
                if(t.CallType__c=='Conversation'){
                    if(t.Contact_Type__c=='Other'){statistics.ConversationOther++;}
                    else if(t.Contact_Type__c=='HR'){statistics.ConversationHR++;}
                    else if(t.Contact_Type__c=='C-Suite'){statistics.ConversationCSuite++;}
                }
                else if(t.CallType__c=='Left Voicemail'){
                    statistics.voiceMail++;
                }
                else if(t.CallType__c=='NML'){
                    statistics.NML++;
                }
                else if(t.CallType__c=='Follow up reminder'){
                    statistics.FollowUpReminder++;
                }
                whatids.add(t.whatid);
            }
            List<Account> prospects=[select Name,client_territories__c from Account where ID in :whatids];
            For(Account a: prospects)
            {
                if(clientsmp.containsKey(a.client_territories__c)){
                    Integer num=clientsmp.get(a.client_territories__c)+1;
                    clientsmp.put(a.client_territories__c, num);
                }
                else {
                    clientsmp.put(a.client_territories__c, 1);
                }
            }            
            For(String acctname : clientsmp.keySet()){
                clients c=new clients();
                c.count=clientsmp.get(acctname);
                c.name=acctname;
                clientscount.add(c);
            }
            
            For(Opportunity o : repopps){
                if(o.Opportunity_Type__c=='RFI'){
                    statistics.RFI++;
                }
                else if(o.Opportunity_Type__c=='Lead'){
                    if(o.Invoice_Status__c=='Lead Sold/Charged'){
                        statistics.AcceptedLeads++;
                    }
                    else if(o.Invoice_Status__c=='Lead Refunded'){
                        statistics.DeclinedLeads++;
                    }
                }
            }
            
        }
        renderPie=true;
        getActivitiesPieData();
        System.debug(ActivitiesPieData);
        getClientsPieData();
        System.debug(ClientsPieData);
    }
    

    
    //get the reps' names for the dropdown list
    public List<SelectOption> getReps(){
        List<SelectOption> options=new List<SelectOption>();
        for(User u : repsList){
            options.add(new SelectOption(u.id,u.name));
        }
        return options;
    }
    
    public class repstats
    {
        public repstats()
        {
            totalActivities=0;voiceMail=0;ConversationCSuite=0;ConversationHR=0;ConversationOther=0;AcceptedLeads=0;
            RFI=0;NML=0;FollowUpReminder=0;DeclinedLeads=0;
        }
        public integer totalActivities{get;set;}
        public integer voiceMail{get;set;}
        public integer ConversationCSuite{get;set;}
        public integer ConversationHR{get;set;}
        public integer ConversationOther{get;set;}
        public integer AcceptedLeads{get;set;}
        public integer RFI{get;set;}
        public integer NML{get;set;}
        public integer FollowUpReminder{get;set;}
        public integer DeclinedLeads{get;set;}
        
    }
    public class clients{
        public String Name{get;set;}
        public integer count{get;set;}
        public String ID{get;set;}        
    }
    
    
    
}

My VF Page:
<apex:page controller="AR_RepWorkingReport" showHeader="false" sidebar="false" standardStylesheets="false" docType="html-5.0">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script>
    var startdate,enddate;
    $(document).ready(function(){
        $("#arstart").datepicker({
        onSelect:function(dateText,inst){
            startdate=$(this).val();
            if(typeof enddate!=='undefined'){
                callActionMethod();
            }
        }}); 
        $("#arend").datepicker({
        onSelect:function(dateText,inst){
            enddate=$(this).val();
            if(typeof startdate!=='undefined'){
                callActionMethod();
            }
        }});    
    });
</script>
<script>
    function callActionMethod()
    {
        echo(startdate,enddate);
    }
</script>

<style type="text/css">
.pointer
{
    cursor:pointer;
    border:1px solid #ccc;
    padding: 5px;
}
</style>

</head>
<body>
    <div class="container">
        <div class="row well">
        <apex:form >  
            <div class="col-sm-2">         
                <apex:selectList value="{!selectedRep}" styleClass="form-control" size="1">           
                    <apex:selectOptions value="{!Reps}"></apex:selectOptions>
                    <apex:actionSupport event="onchange" reRender="resultPanel" action="{!fetchRepBehaviors}" status="myStatus"/>
                </apex:selectList>           
            </div>       
            <div style="float:left;">From:</div>
            <div class="col-sm-2 form-search">                        
                <input id="arstart"/>
            </div>
            <div style="float:left;">To:</div>
            <div class="col-sm-2">
                <input id="arend" />
            </div> 
         <apex:actionfunction name="echo" action="{!fetchRepBehaviors}" reRender="resultPanel" status="myStatus">
            <apex:param name="startdate" assignTo="{!startdate}" value=""/>
            <apex:param name="enddate" assignTo="{!enddate}" value=""/>    
        </apex:actionFunction>
        </apex:form>  
    </div>
</div>
<apex:outputPanel id="resultPanel">
        <apex:actionstatus startText="Requesting..." stopText="" id="myStatus" styleclass="hassuccess"/>
    <div class="container">
        <div class="row">
            <div class="col-md-3">    
                <table class="table  table-hover">
                    <tr>
                    <td style="color:orange"><apex:outputLabel value="Activity Type"/></td>
                    <td style="color:orange"><apex:outputLabel value="Count"/></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Voice Mail"/></td>
                    <td><apex:outputText value="{!statistics.voiceMail}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Conversation with C Suite"/></td>
                    <td><apex:outputText value="{!statistics.ConversationCSuite}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Conversation with HR"/></td>
                    <td><apex:outputText value="{!statistics.ConversationHR}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Conversation - Other"/></td>
                    <td><apex:outputText value="{!statistics.ConversationOther}"></apex:outputText></td>
                    </tr>                
                    <tr>
                    <td><apex:outputLabel value="No Message Left"/></td>
                    <td><apex:outputText value="{!statistics.NML}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Follow Up Reminder"/></td>    
                    <td><apex:outputText value="{!statistics.FollowUpReminder}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><b><apex:outputLabel value="Total Activities" style="color:red;"/></b></td>    
                    <td><apex:outputText value="{!statistics.totalActivities}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Accepted Leads"/></td>
                    <td><apex:outputText value="{!statistics.AcceptedLeads}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="Declined Leads"/></td>
                    <td><apex:outputText value="{!statistics.DeclinedLeads}"></apex:outputText></td>
                    </tr>
                    <tr>
                    <td><apex:outputLabel value="RFI"/></td>
                    <td><apex:outputText value="{!statistics.RFI}"></apex:outputText></td>
                    </tr>
                </table>    
            </div>
  
        <div class="col-md-5">    
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th style="color:orange">Client Territory</th>
                        <th style="color:orange">Count</th>
                    </tr>
                </thead>
                <tbody>
                    <apex:repeat value="{!clientscount}" var="List">
                    <tr>
                        <td><apex:outputLabel value="{!List.Name}"></apex:outputLabel></td>
                          <td><apex:outputLabel value="{!List.count}"></apex:outputLabel></td>
                    </tr>
                    </apex:repeat>
                </tbody>
            </table>
         </div>  
       </div>
    </div>
    
<div>
            <apex:chart height="350" width="450" data="{!AcPieData}" rendered="{!renderPie}">
                <apex:pieSeries dataField="data" labelField="name"/>
                <apex:legend position="right"/>
            </apex:chart>  
            </div>
            <div>

</div>
</apex:outputPanel>
         <div class="navbar navbar-default navbar-fixed-bottom">
    <div class="container">
        <p class="navbar-text pull-left">Site Built by Jack Wang, Dallas TX, 2014</p>
        <a class="navbar-btn btn-info btn pull-right" href="mailto:jack.wang@accelerationretirement.com">Contact Me</a> 
    </div>  
    </div>



</body>
</html>
</apex:page>

The JS Debug Log:
User-added image

User-added image