• Justin Ruck
  • NEWBIE
  • 50 Points
  • Member since 2014
  • Sales Operations Analyst
  • Metrie, Inc.


  • Chatter
    Feed
  • 0
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 19
    Replies
I have an Site where I'm hosting a survey.  The link to the survey is going out in an email blast to Contacts.  We want to link the Contact to the survey.  What I was thinking is that the Site could somehow capture what the email address is of the person who clicked the link in the email that took them to the survey.  However, I'm not sure how to do this or if there is a better solution.  Would you please provide your suggestions and any related code?
I have a user who change change the contact owner on the contacts that he owns in Classic.  However, when he's in Lightning Experience, he doesn't have that ability.  See screenshots below.  How can I fix this?

Classic:

AJ Classic

Lightning:

AJ Lightning
My landing page in Classic is a VisualForce page.  I have Lightning Experience enabled.  When I'm on the landing page in Classic and I click my name then "Switch to Lightning Experience", the page goes nowhere.  However, when I go to a standard tab, like Opportunities, then click "Switch to Lightning Experience", it works just fine.  This is affecting all users in my org.

Any idea what might be going wrong?

I'll paste my VF page code below, but there's no reason why it should affect this.
 
<apex:page controller="ChartClass" title="Metrie Home Page" readonly="true">
    
    <apex:sectionHeader title="Metrie Home Page" subtitle="">
        <apex:panelGrid columns="1" width="100%">
            <c:NewsTicker />
        </apex:panelGrid>
        <apex:outputText value="Viewing {0}" style="font-size:22px;font-weight:bold;">
            <apex:param value="{!chartScope}"/>
        </apex:outputText>
    </apex:sectionHeader>
    
    <apex:panelGrid columns="2">
        
        <apex:panelGrid columns="1">
            
            <apex:panelGrid columns="3" width="100%">
                <c:MetrieNewsComponent />
                <c:MetrieHomePageComponent />
                <c:GamificationComponent />
            </apex:panelGrid>
            
            <apex:panelGrid columns="3" width="100%">
                <apex:panelgroup >
                    <c:Top10OpenOppsList />
                </apex:panelgroup>
                <apex:panelgroup >
                    <c:Top10CasesList />
                    <c:OpenCasesComponent />
                </apex:panelgroup>
                
                <apex:panelgroup >
                    <c:OpenTaskComponent />
                    <a href="/007">Click here for more open Tasks</a>
                </apex:panelgroup>
            </apex:panelGrid>
        </apex:panelGrid>

        

        <apex:panelGrid columns="1" width="100%" >            
            <apex:outputPanel layout="block" style="overflow:auto;width:500px;height:667px" >
                <chatter:newsfeed />
            </apex:outputPanel>
        </apex:panelGrid>
    </apex:panelGrid>
    
</apex:page>



 
I have a custom object that has a lookup field to the Contact object.  I did the related lookup filter so that it would only pull in results for Contacts on that related Account.  The issue is that in Lightning Experience, when I click on this Contact lookup field, it shows my Recently Viewed contacts, whether they were for the related account or not.  I'd like to either somehow filter that Recently Viewed list or remove the Recently Viewed when the user clicks on the lookup field.

Any ideas on how to do that?  
I have a user that owns an Opportunity record, and when he goes to create a New Task on the Opportunity record, he gets the below error.  I tried to reproduce both under my login and logging in as him, but I cannot reproduce the error.  Any idea why this might be happening?

User-added image
I do not have the option in IE 11 to switch to Lightning Experience.  I do, however, have the option in Chrome.  What might be the issue?

What I see in Chrome:
Chrome

What I see in IE 11:
IE 11
IE 11 version information:
User-added image
My company has an API connection to an external system which updates SFDC nightly.  How can I turn off its access to the Account object?

The external system is sending incorrect information to the Account object.  Unfortunately, the administrator on the external system has no idea how to change the settings on her side.  So, I want to just turn off the access to that.  I want to keep the other integrations to other objects, though.

I've gone through the profile, which is a custom profile specifically for API.  I changed all settings for Accounts to read-only.  I checked the sharing settings, and there's nothing shared with that profile or a group that the API user is in.  But, it's still somehow able to update Accounts.  
In Trailhead, next to the List Views, there is a settings cog and over on the right there is a filter button.  These are both missing.  Any ideas what may be causing this issue?  

What I expect:
User-added image

What I get:

User-added image
I have a VF page that works just find in Classic, but when I go to its tab in Lightning Experience, I just get a blank page.  Any ideas as to why this may be happening?
 
<apex:page controller="VirtualReportController" title="Metrie Reports" readonly="true">
    <apex:sectionHeader title="Personalized Salesforce.com Reports" subtitle="{!UserName}">
        <apex:pageBlock >
            <apex:outputText value="Your profile has a reporting level of {0} giving you access to the following reports:">
                <apex:param value="{!reportLevel}"/>
            </apex:outputText>
            <br/><br/><br/>
            <table border="0">
                <apex:repeat value="{!ReportGroups}" var="group">
                    <tr>
                        <td colspan="2">
                            <b>{!group.Name}</b> - {!group.reportsCount} reports
                        </td>
                    </tr>
                    <tr/>
                    <apex:repeat value="{!group.reports}" var="r">
                        <tr>
                            <td width="30px"></td>
                            <td><apex:outputLink value="{!r.Url}" title="{!r.Description}">{!r.Name}</apex:outputLink></td>
                        </tr>
                    </apex:repeat>
                </apex:repeat>
            </table>
        </apex:pageBlock>
    </apex:sectionHeader>
</apex:page>

 
In Lightning Experience, when I'm on a record and select "Activity", I get only "New Task" and "New Event".  How can I get Email and Log Call on there, like they're supposed to be? 
I have a VF page when an iframe on a ChatterNews VF page.  When there's a file, like an image, and someone hovers over it and clicks it, the "Document Preview" box comes up, but shows nothing.  What might be the issue?

And before I get questions on why I didn't use <chatter:newsfeed> directly, it's because that brings back the entire feed and I wanted to limit the page height.  So, I created a separate VF page that housed the <chatter:newsfeed> and just did an iframe to it. 

Here's the code:

VF page with iframe:
<apex:panelGrid columns="1" width="100%" >            
            <apex:iframe src="/apex/ChatterNews?isdtp=nv" height="658px" width="500px" scrolling="true"/>
        </apex:panelGrid>

ChatterNews page:
<apex:page sidebar="false" showHeader="false">
        <apex:panelGrid columns="1" width="75%">            
                <chatter:newsfeed id="newsFeed"/>
        </apex:panelGrid>
</apex:page>

Image of what the preview shows:
Blank Document Preview
I'm designing a leaderboard in VF that will bring back a table with either the top users with won opps, the top users for all ops, and the top users with tasks.  It's one table, but the type of data listed will be determined by a drop down, called selectedVal.  I've verified that I do have data there that should be pulling in, but there is no data that pulls through.  Would you please let me know what might fix this issue?

Leaderboard Issue
Controller:
 
public class LeaderboardsController {
    
    public list<AggregateResult> EntireList = new list<AggregateResult>();
    public list<allList> Top10List { get; private set; }
    public String OwnedBy { get; private set; }  
    public Integer Amount { get; private set; }  
    
    public LeaderboardsController()
        
    {
        
        //chart data       
        if (selectedVal == 'Top Won Opportunity Sales Leaders')
        {
            EntireList = [select Owned_By__c owner, sum(AMOUNT) amt
                          from Opportunity
                          where CloseDate = THIS_FISCAL_QUARTER and StageName = 'Closed Won'
                          group by Owned_By__c                                     
                          ORDER BY sum(Amount) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else if (selectedVal == 'Top Opportunity Sales Leaders')
        {
            EntireList = [select Owned_By__c owner, sum(AMOUNT) amt
                          from Opportunity
                          where CREATEDDATE = THIS_FISCAL_QUARTER
                          group by Owned_By__c                                     
                          ORDER BY sum(Amount) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else if (selectedVal == 'Top Meeting Leaders')
        {
            EntireList = [select OwnerID owner, count(Subject) amt
                          from Task
                          where CreatedDate = THIS_FISCAL_QUARTER and ActivityType__c = 'Meeting'
                          group by OwnerID                                    
                          ORDER BY count(Subject) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else return;
        
        Top10List = new List<allList>();
        for (AggregateResult ar : EntireList) {
            Top10List.add(new allList(ar));
        }
    }
    //wrapper
    public class allList {
        public String OwnedBy { get; private set; }  
        public Integer Amount { get; private set; }  
        
        public allList(AggregateResult ar)  
        {  
            this.OwnedBy = String.valueOf(ar.get('owner'));  
            this.Amount = Integer.valueOf(ar.get('amt'));
        }
    }          
    
    //drop down boxes
    public String selectedVal{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenPresentationOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        optns.add(new SelectOption('Top Won Opportunity Sales Leaders','Top Won Opportunity Sales Leaders'));
        optns.add(new SelectOption('Top Opportunity Sales Leaders','Top Opportunity Sales Leaders'));
        optns.add(new SelectOption('Top Meeting Leaders','Top Meeting Leaders'));
       
        
        return optns;
    }
    
    public String selectedCountry{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenCountryOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        optns.add(new SelectOption('ALL','All'));        
        optns.add(new SelectOption('US Distribution','US Distribution'));
        optns.add(new SelectOption('CA Distribution','CA Distribution'));
        optns.add(new SelectOption('Contract','Contract'));
        optns.add(new SelectOption('Manufacturing','Manufacturing'));
        optns.add(new SelectOption('US Retail','US Retail'));
        
        
        return optns;
    }
    
    public String selectedRegion{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenRegionOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        if(selectedCountry == 'US Distribution')
        {
            optns.add(new SelectOption('All','All'));
            optns.add(new SelectOption('Atlantic US','Atlantic US'));        
            optns.add(new SelectOption('Mid West','Mid West'));
            optns.add(new SelectOption('South East','South East'));
            optns.add(new SelectOption('South West','South West'));
            optns.add(new SelectOption('West','West'));
        }
        else if(selectedCountry == 'CA Distribution')
        {
            optns.add(new SelectOption('All','All'));
            optns.add(new SelectOption('Atlantic Canada','Atlantic Canada'));        
            optns.add(new SelectOption('BC','BC'));
            optns.add(new SelectOption('Head Office','Head Office'));
            optns.add(new SelectOption('Ontario','Ontario'));
            optns.add(new SelectOption('Prairies','Prairies'));
            optns.add(new SelectOption('Quebec','Quebec'));
        }
        else if(selectedCountry == 'Contract')
        {
            optns.add(new SelectOption('All','All'));
        }
        else if(selectedCountry == 'Manufacturing')
        {
            optns.add(new SelectOption('All','All'));
        }
        else if(selectedCountry == 'US Retail')
        {
            optns.add(new SelectOption('All','All'));
        }
        else
        {
            optns.add(new SelectOption('All','All'));
        }
        
        return optns;
    }
}

VF page:
 
<apex:page controller="LeaderboardsController" title="Leaderboards" readonly="false">
    <apex:form >
        <apex:selectList value="{!selectedVal}" size="1"> 
            <apex:selectOptions value="{!openPresentationOptions}" />
            <apex:actionSupport event="onchange" reRender="b"/>
        </apex:selectList>
        <apex:selectList value="{!selectedCountry}" size="1"> 
            <apex:selectOptions value="{!openCountryOptions}" /> 
            <apex:actionSupport event="onchange" reRender="a,b"/>
        </apex:selectList>
        <apex:selectList value="{!selectedRegion}" size="1" id="a"> 
            <apex:selectOptions value="{!openRegionOptions}" /> 
            <apex:actionSupport event="onchange" reRender="b"/>
        </apex:selectList>
    </apex:form>    
    <br/>
    <br/>
        <apex:pageBlock id="b">
        <apex:variable var="rowcount" value="{!1}" />
        <apex:pageBlockTable value="{!Top10List}" var="ar" >  
            <apex:column >
                {!rowcount} <apex:variable var="rowcount" value="{!rowcount+1}" />
            </apex:column>
            <apex:column value="{!ar.OwnedBy}" headerValue="User"/>
            <apex:column style="text-align:right" headerClass="CurrencyElement">
                <apex:facet name="header"><b>Total</b></apex:facet>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!ar.Amount}"/>
                </apex:outputText>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 
I have a table in a VisualForce page that is only showing headers.  I checked my controller, and there are values in the Sandbox for my query.  Is there anything you can see as to why the table isn't pulling in values?

VF Page:
 
<apex:page controller="HomeGamificationController">
    <apex:pageBlock title="Rank">
        <apex:pageBlockTable value="{!Top10List}" var="ar" rows="10" width="50%">  
            <apex:column headerValue="Owner">
                <apex:outputText value="{!OwnedBy}"/>
            </apex:column>
            <apex:column headervalue="Closed Amount">
                <apex:outputText value="{!Amount}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

APEX Class
 
public class HomeGamificationController 
{
    public list<AggregateResult> lstAR = new list<AggregateResult>();
    public list<oppClass> Top10List { get; private set; }
    private User currentUser { get; private set; }
    public String OwnedBy { get; private set; }
    public Double Amount { get; private set; }
    
    public HomeGamificationController()
        
        
    {
        //pulling the current user information
        this.currentUser = Database.query ('select Branch__c, BranchShort__c, RegionSGI__c, Country, ReportLevel__c, X2015_Collections_Budget__c from User where Id = \'' + UserInfo.getUserId() + '\' limit 1');
        
        //there are many different levels of users, with some seeing different data
        if (this.currentUser.ReportLevel__c == 'Territory Manager')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c  and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c                                     
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        
        else if (this.currentUser.ReportLevel__c == 'Market Manager')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c  and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        
        else if (this.currentUser.ReportLevel__c == 'Sales Director')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        else if (this.currentUser.ReportLevel__c == 'VP of Sales')
        {
            lstAR = [select Owned_By__c owner, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Owner.Country = :this.currentUser.Country and
                     Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        else if (this.currentUser.ReportLevel__c == 'Corporate')
        {
            lstAR = [select Owned_By__c owner, sum(Amount) amt
                     from Opportunity
                     where Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        List<oppClass> Top10List = new List<oppClass>();
        for (AggregateResult ar : lstAR) {
            Top10List.add(new oppClass(ar));
        }
        return;
    }
    
    //wrapper
    public class oppClass  
    {  
        String OwnedBy { get; private set; }  
        public Double Amount { get; private set; }  
        
        public oppClass(AggregateResult ar)  
        {  
            OwnedBy = String.valueOf(ar.get('owner'));  
            Amount = Double.valueOf(ar.get('amt'));  
            
        }  
    }  
}

 
I have a VF page that is quite large and takes some time to load, due to a few charts which pulls in data from 3 objects.  To have a smaller size and less load time, what would be the best option:  Would it be to create a separate VF page for the charts and just do an apex:include?  Should I create a component for the charts and just pull them into the VF page?  Or should I just leave the charts directly on the page?  
I created a VF Home tab that has a few charts at the top (with tooltips), and below is a section with the Chatter newsfeed on the left and the Activities object on the right (with only 2 filter options, "My Open Tasks" and "My Open Meetings", which doesn't contain tons of data).  The loading time is too long.  First load takes a couple minutes and after that, takes about 7 seconds.  But other than that, everything works excellently.  

The charts are pulling data from a few different objects - Users, Opportunities, and Accounts.  Would it be better to have the charts in a separate VF page and then just pull that VF page into this new VF Home tab?  Any help is appreciated.  

VF:
 
<apex:page controller="HomePageController" title="Metrie Home Page" readonly="true">
<script type="text/javascript">
function renderSalesBudgetChartTip(klass, item)
{
    console.log (klass);
    console.log (item);
    console.log (this);
    var yField = item.yField; // dataSales or dataBudget
    var name = item.storeItem.get('name'); // doors, mouldings, sheets, other
    var label;
    if (yField == 'dataSales')
        label = 'Sales';
    else if (yField == 'dataBudget')
        label = 'Budget';
    else
        label = '';
    
    var amount = item.storeItem.get(yField);
    this.height = 50; // Fixed height, how to force a recalc of the size?
    this.setTitle(name + ' ' + label + ': $' + amount.formatMoney(0));
}
function renderCollectionsChartTip(klass, item)
{
    //console.log (item);
    var yField = item.yField; // sales or budget
    var monthName = item.storeItem.get('month'); // Jan - Dec
    var label;
    if (yField == 'sales')
        label = 'Sales';
    else if (yField == 'budget')
        label = 'Budget'
    else if (yField == 'custsales')
        label = 'Customer Sales'
    else
        label = '';
    
    var amount = item.storeItem.get(yField);
    this.height = 40;
    this.setTitle(monthName + ' ' + label + ': $' + amount.formatMoney(0));
}
Number.prototype.formatMoney = function(c, d, t){
var n = this, 
    c = isNaN(c = Math.abs(c)) ? 2 : c, 
    d = d == undefined ? "." : d, 
    t = t == undefined ? "," : t, 
    s = n < 0 ? "-" : "", 
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 
    j = (j = i.length) > 3 ? j % 3 : 0;
   return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
 };
</script>
<style>
.chartTitle { font-size:16px;font-weight:bold }
.chartSubTitleText { text-align:right; width:60%; font-size:12px;font-weight:bold;}
.chartSubTitleValue { text-align:right; font-size:12px;font-weight:bold;}
.chartColumn { text-align: center;}
</style>
    <apex:sectionHeader title="Metrie Home Page" subtitle="">
        <apex:outputText rendered="{!HasSalesCharts}" value="Charts for {0}" style="font-size:22px;font-weight:bold;">
            <apex:param value="{!chartScope}"/>
        </apex:outputText>
        
        <apex:panelGrid rendered="{!HasSalesCharts}" columns="3" columnClasses="chartColumn">
            <apex:panelGroup >
                <apex:outputText value="MTD" styleClass="chartTitle"/>
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!MTDTotalSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!MTDTotalBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
    
                <apex:chart height="250" width="350" data="{!MTDChartData}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="dataSales,dataBudget" minimum="0" title="Sales vs Budget"/>
                <apex:axis type="Category" position="bottom" fields="name" title="Product"/>
                <apex:barSeries orientation="vertical" axis="left" xField="name" yField="dataSales,dataBudget" title="Sales,Budget" colorSet="#FFCC00,#969696" colorsProgressWithinSeries="true">
                    <apex:chartTips rendererFn="renderSalesBudgetChartTip"/>
                </apex:barSeries>
                </apex:chart>
            </apex:panelGroup>
    
            <apex:panelGroup >
                <apex:outputText value="YTD" styleClass="chartTitle"/>
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDTotalSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDTotalBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
     
                <apex:chart height="250" width="350" data="{!YTDChartData}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="dataSales,dataBudget" minimum="0" title="Sales vs Budget"/>
                <apex:axis type="Category" position="bottom" fields="name" title="Product"/>
                <apex:barSeries orientation="vertical" axis="left" xField="name" yField="dataSales,dataBudget" title="Sales,Budget" colorSet="#FFCC00,#969696" colorsProgressWithinSeries="true">
                    <apex:chartTips rendererFn="renderSalesBudgetChartTip"/>
                </apex:barSeries>
                </apex:chart>
            </apex:panelGroup>
    
            <apex:panelGroup >
                <apex:outputText value="Collections YTD" styleClass="chartTitle" />
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionCustSales}"/>
                </apex:outputText>    
                <apex:outputText value="Open Oppty:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
     
                <apex:chart height="250" width="350" data="{!CollectionChart}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="sales,custsales,budget" minimum="0" title="Collections $"/>
                <apex:axis type="Category" position="bottom" fields="month" title="Close Date"/>
                <apex:barSeries orientation="vertical" axis="left" xField="month" yField="sales" title="Open Oppty" colorSet="#FF9900">
                    <apex:chartTips rendererFn="renderCollectionsChartTip"/>
                </apex:barSeries>
                <apex:lineSeries axis="left" xField="month" yField="custsales" title="Sales" fill="true" markerType="cross" markerSize="4" fillColor="#FFFF99" markerFill="#FFCC00"/>
                <apex:lineSeries axis="left" xField="month" yField="budget" title="Budget" fill="true" markerType="circle" markerSize="4" fillcolor="#C0C0C0" markerFill="#C0C0C0"/>
                
                </apex:chart>

            </apex:panelGroup>
    
        </apex:panelGrid>
    </apex:sectionHeader>
    
    <apex:panelGrid columns="2" width="100%">
    <chatter:newsfeed id="newsFeed"/>
        
    <apex:enhancedList type="Activity" height="300" customizable="false" rowsPerPage="10"/>

</apex:panelGrid>
</apex:page>

Controller:
 
public class HomePageController
{
	public HomePageController()
	{
		//PromotionText = '<p align="center"><font face="Arial,Sans-Serif"><font size="4">Remember, Ontario has a special on Doors this month, 50% off certain SKUs</font></font></p><p><br></p><p><br></p><p><br></p><p>mimi and mark made presentation to senior leadershup team<br>call with traction on friday<br>we want their ideas not business $<br>meeting was eye opener<br>everybody believes in it but hwere is the value<br>insure by years end one consistent way that we were <br>goto reportign tool<br>inform branch visit weekly sales meetings<br>June 25th &amp; 26th vancouver sales directors &amp; above</p>';
		// What branch and report level for the current user
		this.currentUser = Database.query ('select Branch__c, BranchShort__c, RegionSGI__c, Country, ReportLevel__c, X2015_Collections_Budget__c from User where Id = \'' + UserInfo.getUserId() + '\' limit 1');
		
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			ChartScope = 'My Accounts';
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			ChartScope = this.currentUser.BranchShort__c;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			ChartScope = this.currentUser.RegionSGI__c;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			ChartScope = this.currentUser.Country;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			ChartScope = 'Metrie';
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		
	}
	public String ChartScope { get; private set; }
	public Boolean HasSalesCharts { get { return MTDChartData == null ? false : true; } }
	public List<ChartData> MTDChartData { get; private set; }
	public Decimal MTDTotalSales { get; private set; }
	public Decimal MTDTotalBudget { get; private set; }
	public Decimal YTDTotalSales { get; private set; }
	public Decimal YTDTotalBudget { get; private set; }
	public List<ChartData> YTDChartData { get; private set; }
	public List<CollectionChartData> CollectionChart { get; private set; }
	public Decimal YTDCollectionSales { get; private set; }
	public Decimal YTDCollectionBudget { get; private set; }
    public Decimal YTDCollectionCustSales { get; private set; }
	
	private User currentUser { get; set; }
	private ChartData doorChartData;
	private ChartData mouldingChartData;
	private ChartData sheetChartData;
	private ChartData otherChartData;
	private Decimal totalSales;
	private Decimal totalBudget;
	
	private void CalculateMTDSales()
	{
		List<AggregateResult> shList = null;
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerId = :UserInfo.getUserId() and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerBranch__c = :this.currentUser.Branch__c and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.RegionSGI__c = :this.currentUser.RegionSGI__c and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.Country = :this.currentUser.Country and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else
			return;
		doorChartData = mouldingChartData = sheetChartData = otherChartData = null;
		TallyResults (shList);
		MTDTotalSales = totalSales;
		MTDTotalBudget = totalBudget;
		MTDChartData = new List<ChartData>();
		MTDChartData.add (doorChartData);
		MTDChartData.add (mouldingChartData);
		MTDChartData.add (sheetChartData);
		MTDChartData.add (otherChartData);
	}
	private void CalculateYTDSales()
	{
		List<AggregateResult> shList = null;
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerId = :UserInfo.getUserId() and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerBranch__c = :this.currentUser.Branch__c and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.RegionSGI__c = :this.currentUser.RegionSGI__c and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.Country = :this.currentUser.Country and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else
			return;
		doorChartData = mouldingChartData = sheetChartData = otherChartData = null;
		TallyResults (shList);			
		YTDTotalSales = totalSales;
		YTDTotalBudget = totalBudget;
		YTDChartData = new List<ChartData>();
		YTDChartData.add (doorChartData);
		YTDChartData.add (mouldingChartData);
		YTDChartData.add (sheetChartData);
		YTDChartData.add (otherChartData);
	}
	private void CalculateCollectionSales()
	{
		List<Opportunity> opps = null;
		YTDCollectionSales = 0;
		YTDCollectionBudget = 0;
        List<Account> acct = null;
        YTDCollectionCustSales = 0;
        
        
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsClosed = False and Calendar_Year(CloseDate) = 2015
					and OwnerId = :UserInfo.getUserId()];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where OwnerId = :UserInfo.getUserId()];
			YTDCollectionBudget = this.currentUser.X2015_Collections_Budget__c;
		
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where OwnerID = :UserInfo.getUserId() and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
        }
        }
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.Branch__c = :currentUser.Branch__c];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.Branch__c = :currentUser.Branch__c];
        
			for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where Branch__c = :currentUser.Branch__c and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
             }
             for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Branch__c = :currentUser.BranchShort__c and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
		}
        }
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.RegionSGI__c = :currentUser.RegionSGI__c];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.RegionSGI__c = :currentUser.RegionSGI__c];
            for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where RegionSGI__c = :currentUser.RegionSGI__c and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
            }
             for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Region_SGI__c = :currentUser.RegionSGI__c and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.Country = :currentUser.Country];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.Country = :currentUser.Country];
            for (AggregateResult ar : [select Sum(X2015_Collections_Budget__c) from User where Country = :currentUser.Country and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');

			}
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Country__c = :currentUser.Country and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False  and Calendar_Year(CloseDate) = 2015];
            acct = [select Id, X2015_Collections_Sales__c
                    from Account];			
            for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
			}
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else
			return;
		
        Decimal monthlyBudget;
		if (YTDCollectionBudget > 0)
			monthlyBudget = YTDCollectionBudget / 1;
        else
					monthlyBudget = 0;
        System.Debug ('==monthlyBudget:' + monthlyBudget);
        Decimal custsales;
		if (YTDCollectionCustSales > 0)
			custsales = YTDCollectionCustSales / 1;
		else
					custsales = 0;
        System.Debug ('==custsales:' + custsales);
		CollectionChart = new List<CollectionChartData>();
		CollectionChart.add (new CollectionChartData('J', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('F', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('M', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('A', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('M', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('Jn', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('Jl', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('A', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('S', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('O', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('N', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('D', 0, monthlyBudget, custsales));

               
        for (Opportunity o : opps)
		{
			Integer idx = o.CloseDate.month()-1;
			System.assert(idx >= 0 && idx <= 12);
			CollectionChart[idx].sales += o.CollectionsOpportunityValue__c;
			YTDCollectionSales += o.CollectionsOpportunityValue__c;
			System.debug('==Collection:' + CollectionChart[idx].month + ' $' + CollectionChart[idx].sales);
		}
        
       

		// Remove any months up to the current month with zero value.  Stop at first month
		// found with a zero value.
		Integer currentMonth = Date.today().month()-1;
		System.assert(currentMonth >= 0 && currentMonth < 12);
		for (Integer idx = 11; idx > currentMonth && CollectionChart[idx].sales == 0; idx--)
		{
			CollectionChart.Remove(idx);
		}
	}
	private void TallyResults (List<AggregateResult> results)
	{
		totalSales = totalBudget = 0;
		for (AggregateResult ar : results)		
		{
			String productGroupCode = (String) ar.get('ProductGroupCode__c');
			System.Debug ('==productGroupCode__c:' + productGroupCode + ' Sales:' + ar.get('expr0') + ' Budget:' + ar.get('expr1'));
			if (productGroupCode == 'D')
				doorChartData = new ChartData ('Doors', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'M')
				mouldingChartData = new ChartData ('Mouldings', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'S')
				sheetChartData = new ChartData ('Sheets', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'O')
				otherChartData = new ChartData ('Other', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			totalSales += (Decimal) ar.get('expr0');
			totalBudget += (Decimal) ar.get('expr1');
		}
		if (doorChartData == null)
			doorChartData = new ChartData ('Doors', 0, 0);
		if (mouldingChartData == null)
			mouldingChartData = new ChartData ('Mouldings', 0, 0);
		if (sheetChartData == null)
			sheetChartData = new ChartData ('Sheets', 0, 0);
		if (otherChartData == null)
			otherChartData = new ChartData ('Other', 0, 0);
	}
	
	// Container for the chart data
	public class ChartData
	{
        public String name { get; set; }
        public Decimal dataSales { get; set; }
        public Decimal dataBudget { get; set; }


        public ChartData(String name, Decimal sales, Decimal budget)
        {
            this.name = name;
            this.dataSales = sales;
            this.dataBudget = budget;
        }
	}
	public class CollectionChartData
	{
		public String month { get; set; }
		public String year { get; set; }
		public Decimal sales { get; set; }
		public Decimal budget { get; set; }
        public Decimal custsales { get; set; }

		public CollectionChartData(string month, Decimal sales, Decimal budget, Decimal custsales)
		{
			this.month = month;
			this.sales = sales;
			this.budget = budget;
            this.custsales = custsales;
		}
	}
}

 
My landing page in Classic is a VisualForce page.  I have Lightning Experience enabled.  When I'm on the landing page in Classic and I click my name then "Switch to Lightning Experience", the page goes nowhere.  However, when I go to a standard tab, like Opportunities, then click "Switch to Lightning Experience", it works just fine.  This is affecting all users in my org.

Any idea what might be going wrong?

I'll paste my VF page code below, but there's no reason why it should affect this.
 
<apex:page controller="ChartClass" title="Metrie Home Page" readonly="true">
    
    <apex:sectionHeader title="Metrie Home Page" subtitle="">
        <apex:panelGrid columns="1" width="100%">
            <c:NewsTicker />
        </apex:panelGrid>
        <apex:outputText value="Viewing {0}" style="font-size:22px;font-weight:bold;">
            <apex:param value="{!chartScope}"/>
        </apex:outputText>
    </apex:sectionHeader>
    
    <apex:panelGrid columns="2">
        
        <apex:panelGrid columns="1">
            
            <apex:panelGrid columns="3" width="100%">
                <c:MetrieNewsComponent />
                <c:MetrieHomePageComponent />
                <c:GamificationComponent />
            </apex:panelGrid>
            
            <apex:panelGrid columns="3" width="100%">
                <apex:panelgroup >
                    <c:Top10OpenOppsList />
                </apex:panelgroup>
                <apex:panelgroup >
                    <c:Top10CasesList />
                    <c:OpenCasesComponent />
                </apex:panelgroup>
                
                <apex:panelgroup >
                    <c:OpenTaskComponent />
                    <a href="/007">Click here for more open Tasks</a>
                </apex:panelgroup>
            </apex:panelGrid>
        </apex:panelGrid>

        

        <apex:panelGrid columns="1" width="100%" >            
            <apex:outputPanel layout="block" style="overflow:auto;width:500px;height:667px" >
                <chatter:newsfeed />
            </apex:outputPanel>
        </apex:panelGrid>
    </apex:panelGrid>
    
</apex:page>



 
I have a custom object that has a lookup field to the Contact object.  I did the related lookup filter so that it would only pull in results for Contacts on that related Account.  The issue is that in Lightning Experience, when I click on this Contact lookup field, it shows my Recently Viewed contacts, whether they were for the related account or not.  I'd like to either somehow filter that Recently Viewed list or remove the Recently Viewed when the user clicks on the lookup field.

Any ideas on how to do that?  
I do not have the option in IE 11 to switch to Lightning Experience.  I do, however, have the option in Chrome.  What might be the issue?

What I see in Chrome:
Chrome

What I see in IE 11:
IE 11
IE 11 version information:
User-added image
In Lightning Experience, when I'm on a record and select "Activity", I get only "New Task" and "New Event".  How can I get Email and Log Call on there, like they're supposed to be? 
I have a user who change change the contact owner on the contacts that he owns in Classic.  However, when he's in Lightning Experience, he doesn't have that ability.  See screenshots below.  How can I fix this?

Classic:

AJ Classic

Lightning:

AJ Lightning
My landing page in Classic is a VisualForce page.  I have Lightning Experience enabled.  When I'm on the landing page in Classic and I click my name then "Switch to Lightning Experience", the page goes nowhere.  However, when I go to a standard tab, like Opportunities, then click "Switch to Lightning Experience", it works just fine.  This is affecting all users in my org.

Any idea what might be going wrong?

I'll paste my VF page code below, but there's no reason why it should affect this.
 
<apex:page controller="ChartClass" title="Metrie Home Page" readonly="true">
    
    <apex:sectionHeader title="Metrie Home Page" subtitle="">
        <apex:panelGrid columns="1" width="100%">
            <c:NewsTicker />
        </apex:panelGrid>
        <apex:outputText value="Viewing {0}" style="font-size:22px;font-weight:bold;">
            <apex:param value="{!chartScope}"/>
        </apex:outputText>
    </apex:sectionHeader>
    
    <apex:panelGrid columns="2">
        
        <apex:panelGrid columns="1">
            
            <apex:panelGrid columns="3" width="100%">
                <c:MetrieNewsComponent />
                <c:MetrieHomePageComponent />
                <c:GamificationComponent />
            </apex:panelGrid>
            
            <apex:panelGrid columns="3" width="100%">
                <apex:panelgroup >
                    <c:Top10OpenOppsList />
                </apex:panelgroup>
                <apex:panelgroup >
                    <c:Top10CasesList />
                    <c:OpenCasesComponent />
                </apex:panelgroup>
                
                <apex:panelgroup >
                    <c:OpenTaskComponent />
                    <a href="/007">Click here for more open Tasks</a>
                </apex:panelgroup>
            </apex:panelGrid>
        </apex:panelGrid>

        

        <apex:panelGrid columns="1" width="100%" >            
            <apex:outputPanel layout="block" style="overflow:auto;width:500px;height:667px" >
                <chatter:newsfeed />
            </apex:outputPanel>
        </apex:panelGrid>
    </apex:panelGrid>
    
</apex:page>



 
I do not have the option in IE 11 to switch to Lightning Experience.  I do, however, have the option in Chrome.  What might be the issue?

What I see in Chrome:
Chrome

What I see in IE 11:
IE 11
IE 11 version information:
User-added image
My company has an API connection to an external system which updates SFDC nightly.  How can I turn off its access to the Account object?

The external system is sending incorrect information to the Account object.  Unfortunately, the administrator on the external system has no idea how to change the settings on her side.  So, I want to just turn off the access to that.  I want to keep the other integrations to other objects, though.

I've gone through the profile, which is a custom profile specifically for API.  I changed all settings for Accounts to read-only.  I checked the sharing settings, and there's nothing shared with that profile or a group that the API user is in.  But, it's still somehow able to update Accounts.  
I have a VF page that works just find in Classic, but when I go to its tab in Lightning Experience, I just get a blank page.  Any ideas as to why this may be happening?
 
<apex:page controller="VirtualReportController" title="Metrie Reports" readonly="true">
    <apex:sectionHeader title="Personalized Salesforce.com Reports" subtitle="{!UserName}">
        <apex:pageBlock >
            <apex:outputText value="Your profile has a reporting level of {0} giving you access to the following reports:">
                <apex:param value="{!reportLevel}"/>
            </apex:outputText>
            <br/><br/><br/>
            <table border="0">
                <apex:repeat value="{!ReportGroups}" var="group">
                    <tr>
                        <td colspan="2">
                            <b>{!group.Name}</b> - {!group.reportsCount} reports
                        </td>
                    </tr>
                    <tr/>
                    <apex:repeat value="{!group.reports}" var="r">
                        <tr>
                            <td width="30px"></td>
                            <td><apex:outputLink value="{!r.Url}" title="{!r.Description}">{!r.Name}</apex:outputLink></td>
                        </tr>
                    </apex:repeat>
                </apex:repeat>
            </table>
        </apex:pageBlock>
    </apex:sectionHeader>
</apex:page>

 
In Lightning Experience, when I'm on a record and select "Activity", I get only "New Task" and "New Event".  How can I get Email and Log Call on there, like they're supposed to be? 
I have a VF page when an iframe on a ChatterNews VF page.  When there's a file, like an image, and someone hovers over it and clicks it, the "Document Preview" box comes up, but shows nothing.  What might be the issue?

And before I get questions on why I didn't use <chatter:newsfeed> directly, it's because that brings back the entire feed and I wanted to limit the page height.  So, I created a separate VF page that housed the <chatter:newsfeed> and just did an iframe to it. 

Here's the code:

VF page with iframe:
<apex:panelGrid columns="1" width="100%" >            
            <apex:iframe src="/apex/ChatterNews?isdtp=nv" height="658px" width="500px" scrolling="true"/>
        </apex:panelGrid>

ChatterNews page:
<apex:page sidebar="false" showHeader="false">
        <apex:panelGrid columns="1" width="75%">            
                <chatter:newsfeed id="newsFeed"/>
        </apex:panelGrid>
</apex:page>

Image of what the preview shows:
Blank Document Preview
I'm designing a leaderboard in VF that will bring back a table with either the top users with won opps, the top users for all ops, and the top users with tasks.  It's one table, but the type of data listed will be determined by a drop down, called selectedVal.  I've verified that I do have data there that should be pulling in, but there is no data that pulls through.  Would you please let me know what might fix this issue?

Leaderboard Issue
Controller:
 
public class LeaderboardsController {
    
    public list<AggregateResult> EntireList = new list<AggregateResult>();
    public list<allList> Top10List { get; private set; }
    public String OwnedBy { get; private set; }  
    public Integer Amount { get; private set; }  
    
    public LeaderboardsController()
        
    {
        
        //chart data       
        if (selectedVal == 'Top Won Opportunity Sales Leaders')
        {
            EntireList = [select Owned_By__c owner, sum(AMOUNT) amt
                          from Opportunity
                          where CloseDate = THIS_FISCAL_QUARTER and StageName = 'Closed Won'
                          group by Owned_By__c                                     
                          ORDER BY sum(Amount) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else if (selectedVal == 'Top Opportunity Sales Leaders')
        {
            EntireList = [select Owned_By__c owner, sum(AMOUNT) amt
                          from Opportunity
                          where CREATEDDATE = THIS_FISCAL_QUARTER
                          group by Owned_By__c                                     
                          ORDER BY sum(Amount) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else if (selectedVal == 'Top Meeting Leaders')
        {
            EntireList = [select OwnerID owner, count(Subject) amt
                          from Task
                          where CreatedDate = THIS_FISCAL_QUARTER and ActivityType__c = 'Meeting'
                          group by OwnerID                                    
                          ORDER BY count(Subject) DESC
                          LIMIT 10];
            for (AggregateResult ar : EntireList)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        else return;
        
        Top10List = new List<allList>();
        for (AggregateResult ar : EntireList) {
            Top10List.add(new allList(ar));
        }
    }
    //wrapper
    public class allList {
        public String OwnedBy { get; private set; }  
        public Integer Amount { get; private set; }  
        
        public allList(AggregateResult ar)  
        {  
            this.OwnedBy = String.valueOf(ar.get('owner'));  
            this.Amount = Integer.valueOf(ar.get('amt'));
        }
    }          
    
    //drop down boxes
    public String selectedVal{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenPresentationOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        optns.add(new SelectOption('Top Won Opportunity Sales Leaders','Top Won Opportunity Sales Leaders'));
        optns.add(new SelectOption('Top Opportunity Sales Leaders','Top Opportunity Sales Leaders'));
        optns.add(new SelectOption('Top Meeting Leaders','Top Meeting Leaders'));
       
        
        return optns;
    }
    
    public String selectedCountry{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenCountryOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        optns.add(new SelectOption('ALL','All'));        
        optns.add(new SelectOption('US Distribution','US Distribution'));
        optns.add(new SelectOption('CA Distribution','CA Distribution'));
        optns.add(new SelectOption('Contract','Contract'));
        optns.add(new SelectOption('Manufacturing','Manufacturing'));
        optns.add(new SelectOption('US Retail','US Retail'));
        
        
        return optns;
    }
    
    public String selectedRegion{get;set;}  // This will hold the selected value, the id in here
    
    public List<SelectOption> getopenRegionOptions(){
        List<SelectOption> optns = new List<Selectoption>();
        if(selectedCountry == 'US Distribution')
        {
            optns.add(new SelectOption('All','All'));
            optns.add(new SelectOption('Atlantic US','Atlantic US'));        
            optns.add(new SelectOption('Mid West','Mid West'));
            optns.add(new SelectOption('South East','South East'));
            optns.add(new SelectOption('South West','South West'));
            optns.add(new SelectOption('West','West'));
        }
        else if(selectedCountry == 'CA Distribution')
        {
            optns.add(new SelectOption('All','All'));
            optns.add(new SelectOption('Atlantic Canada','Atlantic Canada'));        
            optns.add(new SelectOption('BC','BC'));
            optns.add(new SelectOption('Head Office','Head Office'));
            optns.add(new SelectOption('Ontario','Ontario'));
            optns.add(new SelectOption('Prairies','Prairies'));
            optns.add(new SelectOption('Quebec','Quebec'));
        }
        else if(selectedCountry == 'Contract')
        {
            optns.add(new SelectOption('All','All'));
        }
        else if(selectedCountry == 'Manufacturing')
        {
            optns.add(new SelectOption('All','All'));
        }
        else if(selectedCountry == 'US Retail')
        {
            optns.add(new SelectOption('All','All'));
        }
        else
        {
            optns.add(new SelectOption('All','All'));
        }
        
        return optns;
    }
}

VF page:
 
<apex:page controller="LeaderboardsController" title="Leaderboards" readonly="false">
    <apex:form >
        <apex:selectList value="{!selectedVal}" size="1"> 
            <apex:selectOptions value="{!openPresentationOptions}" />
            <apex:actionSupport event="onchange" reRender="b"/>
        </apex:selectList>
        <apex:selectList value="{!selectedCountry}" size="1"> 
            <apex:selectOptions value="{!openCountryOptions}" /> 
            <apex:actionSupport event="onchange" reRender="a,b"/>
        </apex:selectList>
        <apex:selectList value="{!selectedRegion}" size="1" id="a"> 
            <apex:selectOptions value="{!openRegionOptions}" /> 
            <apex:actionSupport event="onchange" reRender="b"/>
        </apex:selectList>
    </apex:form>    
    <br/>
    <br/>
        <apex:pageBlock id="b">
        <apex:variable var="rowcount" value="{!1}" />
        <apex:pageBlockTable value="{!Top10List}" var="ar" >  
            <apex:column >
                {!rowcount} <apex:variable var="rowcount" value="{!rowcount+1}" />
            </apex:column>
            <apex:column value="{!ar.OwnedBy}" headerValue="User"/>
            <apex:column style="text-align:right" headerClass="CurrencyElement">
                <apex:facet name="header"><b>Total</b></apex:facet>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!ar.Amount}"/>
                </apex:outputText>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 
I have a table in a VisualForce page that is only showing headers.  I checked my controller, and there are values in the Sandbox for my query.  Is there anything you can see as to why the table isn't pulling in values?

VF Page:
 
<apex:page controller="HomeGamificationController">
    <apex:pageBlock title="Rank">
        <apex:pageBlockTable value="{!Top10List}" var="ar" rows="10" width="50%">  
            <apex:column headerValue="Owner">
                <apex:outputText value="{!OwnedBy}"/>
            </apex:column>
            <apex:column headervalue="Closed Amount">
                <apex:outputText value="{!Amount}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

APEX Class
 
public class HomeGamificationController 
{
    public list<AggregateResult> lstAR = new list<AggregateResult>();
    public list<oppClass> Top10List { get; private set; }
    private User currentUser { get; private set; }
    public String OwnedBy { get; private set; }
    public Double Amount { get; private set; }
    
    public HomeGamificationController()
        
        
    {
        //pulling the current user information
        this.currentUser = Database.query ('select Branch__c, BranchShort__c, RegionSGI__c, Country, ReportLevel__c, X2015_Collections_Budget__c from User where Id = \'' + UserInfo.getUserId() + '\' limit 1');
        
        //there are many different levels of users, with some seeing different data
        if (this.currentUser.ReportLevel__c == 'Territory Manager')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c  and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c                                     
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        
        else if (this.currentUser.ReportLevel__c == 'Market Manager')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c  and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        
        else if (this.currentUser.ReportLevel__c == 'Sales Director')
        {
            lstAR = [select Owned_By__c, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        else if (this.currentUser.ReportLevel__c == 'VP of Sales')
        {
            lstAR = [select Owned_By__c owner, sum(Amount) amt
                     from Opportunity
                     where Opportunity.Owner.Country = :this.currentUser.Country and
                     Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        
        else if (this.currentUser.ReportLevel__c == 'Corporate')
        {
            lstAR = [select Owned_By__c owner, sum(Amount) amt
                     from Opportunity
                     where Close_Date_Current_Quarter__c = True and StageName = 'Closed Won'
                     group by Owned_By__c
                     ORDER BY sum(Amount) ASC
                     LIMIT 10];
            for (AggregateResult ar : lstAR)
                System.debug(ar.get('owner')+'-'+ar.get('amt'));
        }
        
        List<oppClass> Top10List = new List<oppClass>();
        for (AggregateResult ar : lstAR) {
            Top10List.add(new oppClass(ar));
        }
        return;
    }
    
    //wrapper
    public class oppClass  
    {  
        String OwnedBy { get; private set; }  
        public Double Amount { get; private set; }  
        
        public oppClass(AggregateResult ar)  
        {  
            OwnedBy = String.valueOf(ar.get('owner'));  
            Amount = Double.valueOf(ar.get('amt'));  
            
        }  
    }  
}

 
I have a VF page that is quite large and takes some time to load, due to a few charts which pulls in data from 3 objects.  To have a smaller size and less load time, what would be the best option:  Would it be to create a separate VF page for the charts and just do an apex:include?  Should I create a component for the charts and just pull them into the VF page?  Or should I just leave the charts directly on the page?  
I created a VF Home tab that has a few charts at the top (with tooltips), and below is a section with the Chatter newsfeed on the left and the Activities object on the right (with only 2 filter options, "My Open Tasks" and "My Open Meetings", which doesn't contain tons of data).  The loading time is too long.  First load takes a couple minutes and after that, takes about 7 seconds.  But other than that, everything works excellently.  

The charts are pulling data from a few different objects - Users, Opportunities, and Accounts.  Would it be better to have the charts in a separate VF page and then just pull that VF page into this new VF Home tab?  Any help is appreciated.  

VF:
 
<apex:page controller="HomePageController" title="Metrie Home Page" readonly="true">
<script type="text/javascript">
function renderSalesBudgetChartTip(klass, item)
{
    console.log (klass);
    console.log (item);
    console.log (this);
    var yField = item.yField; // dataSales or dataBudget
    var name = item.storeItem.get('name'); // doors, mouldings, sheets, other
    var label;
    if (yField == 'dataSales')
        label = 'Sales';
    else if (yField == 'dataBudget')
        label = 'Budget';
    else
        label = '';
    
    var amount = item.storeItem.get(yField);
    this.height = 50; // Fixed height, how to force a recalc of the size?
    this.setTitle(name + ' ' + label + ': $' + amount.formatMoney(0));
}
function renderCollectionsChartTip(klass, item)
{
    //console.log (item);
    var yField = item.yField; // sales or budget
    var monthName = item.storeItem.get('month'); // Jan - Dec
    var label;
    if (yField == 'sales')
        label = 'Sales';
    else if (yField == 'budget')
        label = 'Budget'
    else if (yField == 'custsales')
        label = 'Customer Sales'
    else
        label = '';
    
    var amount = item.storeItem.get(yField);
    this.height = 40;
    this.setTitle(monthName + ' ' + label + ': $' + amount.formatMoney(0));
}
Number.prototype.formatMoney = function(c, d, t){
var n = this, 
    c = isNaN(c = Math.abs(c)) ? 2 : c, 
    d = d == undefined ? "." : d, 
    t = t == undefined ? "," : t, 
    s = n < 0 ? "-" : "", 
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 
    j = (j = i.length) > 3 ? j % 3 : 0;
   return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
 };
</script>
<style>
.chartTitle { font-size:16px;font-weight:bold }
.chartSubTitleText { text-align:right; width:60%; font-size:12px;font-weight:bold;}
.chartSubTitleValue { text-align:right; font-size:12px;font-weight:bold;}
.chartColumn { text-align: center;}
</style>
    <apex:sectionHeader title="Metrie Home Page" subtitle="">
        <apex:outputText rendered="{!HasSalesCharts}" value="Charts for {0}" style="font-size:22px;font-weight:bold;">
            <apex:param value="{!chartScope}"/>
        </apex:outputText>
        
        <apex:panelGrid rendered="{!HasSalesCharts}" columns="3" columnClasses="chartColumn">
            <apex:panelGroup >
                <apex:outputText value="MTD" styleClass="chartTitle"/>
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!MTDTotalSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!MTDTotalBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
    
                <apex:chart height="250" width="350" data="{!MTDChartData}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="dataSales,dataBudget" minimum="0" title="Sales vs Budget"/>
                <apex:axis type="Category" position="bottom" fields="name" title="Product"/>
                <apex:barSeries orientation="vertical" axis="left" xField="name" yField="dataSales,dataBudget" title="Sales,Budget" colorSet="#FFCC00,#969696" colorsProgressWithinSeries="true">
                    <apex:chartTips rendererFn="renderSalesBudgetChartTip"/>
                </apex:barSeries>
                </apex:chart>
            </apex:panelGroup>
    
            <apex:panelGroup >
                <apex:outputText value="YTD" styleClass="chartTitle"/>
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDTotalSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDTotalBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
     
                <apex:chart height="250" width="350" data="{!YTDChartData}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="dataSales,dataBudget" minimum="0" title="Sales vs Budget"/>
                <apex:axis type="Category" position="bottom" fields="name" title="Product"/>
                <apex:barSeries orientation="vertical" axis="left" xField="name" yField="dataSales,dataBudget" title="Sales,Budget" colorSet="#FFCC00,#969696" colorsProgressWithinSeries="true">
                    <apex:chartTips rendererFn="renderSalesBudgetChartTip"/>
                </apex:barSeries>
                </apex:chart>
            </apex:panelGroup>
    
            <apex:panelGroup >
                <apex:outputText value="Collections YTD" styleClass="chartTitle" />
                <apex:panelGrid columns="2" width="85%" columnClasses="chartSubTitleText,chartSubTitleValue">
                
                <apex:outputText value="Sales:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionCustSales}"/>
                </apex:outputText>    
                <apex:outputText value="Open Oppty:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionSales}"/>
                </apex:outputText>
                <apex:outputText value="Budget:"/>
                <apex:outputText value="${0, number, ###,###,##0}">
                    <apex:param value="{!YTDCollectionBudget}"/>
                </apex:outputText>
                </apex:panelGrid>
     
                <apex:chart height="250" width="350" data="{!CollectionChart}">
                <apex:legend position="bottom" font="10px Helvetica"/>
                <apex:axis type="Numeric" position="left" fields="sales,custsales,budget" minimum="0" title="Collections $"/>
                <apex:axis type="Category" position="bottom" fields="month" title="Close Date"/>
                <apex:barSeries orientation="vertical" axis="left" xField="month" yField="sales" title="Open Oppty" colorSet="#FF9900">
                    <apex:chartTips rendererFn="renderCollectionsChartTip"/>
                </apex:barSeries>
                <apex:lineSeries axis="left" xField="month" yField="custsales" title="Sales" fill="true" markerType="cross" markerSize="4" fillColor="#FFFF99" markerFill="#FFCC00"/>
                <apex:lineSeries axis="left" xField="month" yField="budget" title="Budget" fill="true" markerType="circle" markerSize="4" fillcolor="#C0C0C0" markerFill="#C0C0C0"/>
                
                </apex:chart>

            </apex:panelGroup>
    
        </apex:panelGrid>
    </apex:sectionHeader>
    
    <apex:panelGrid columns="2" width="100%">
    <chatter:newsfeed id="newsFeed"/>
        
    <apex:enhancedList type="Activity" height="300" customizable="false" rowsPerPage="10"/>

</apex:panelGrid>
</apex:page>

Controller:
 
public class HomePageController
{
	public HomePageController()
	{
		//PromotionText = '<p align="center"><font face="Arial,Sans-Serif"><font size="4">Remember, Ontario has a special on Doors this month, 50% off certain SKUs</font></font></p><p><br></p><p><br></p><p><br></p><p>mimi and mark made presentation to senior leadershup team<br>call with traction on friday<br>we want their ideas not business $<br>meeting was eye opener<br>everybody believes in it but hwere is the value<br>insure by years end one consistent way that we were <br>goto reportign tool<br>inform branch visit weekly sales meetings<br>June 25th &amp; 26th vancouver sales directors &amp; above</p>';
		// What branch and report level for the current user
		this.currentUser = Database.query ('select Branch__c, BranchShort__c, RegionSGI__c, Country, ReportLevel__c, X2015_Collections_Budget__c from User where Id = \'' + UserInfo.getUserId() + '\' limit 1');
		
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			ChartScope = 'My Accounts';
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			ChartScope = this.currentUser.BranchShort__c;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			ChartScope = this.currentUser.RegionSGI__c;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			ChartScope = this.currentUser.Country;
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			ChartScope = 'Metrie';
			CalculateMTDSales();
			CalculateYTDSales();
			CalculateCollectionSales();
		}
		
	}
	public String ChartScope { get; private set; }
	public Boolean HasSalesCharts { get { return MTDChartData == null ? false : true; } }
	public List<ChartData> MTDChartData { get; private set; }
	public Decimal MTDTotalSales { get; private set; }
	public Decimal MTDTotalBudget { get; private set; }
	public Decimal YTDTotalSales { get; private set; }
	public Decimal YTDTotalBudget { get; private set; }
	public List<ChartData> YTDChartData { get; private set; }
	public List<CollectionChartData> CollectionChart { get; private set; }
	public Decimal YTDCollectionSales { get; private set; }
	public Decimal YTDCollectionBudget { get; private set; }
    public Decimal YTDCollectionCustSales { get; private set; }
	
	private User currentUser { get; set; }
	private ChartData doorChartData;
	private ChartData mouldingChartData;
	private ChartData sheetChartData;
	private ChartData otherChartData;
	private Decimal totalSales;
	private Decimal totalBudget;
	
	private void CalculateMTDSales()
	{
		List<AggregateResult> shList = null;
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerId = :UserInfo.getUserId() and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerBranch__c = :this.currentUser.Branch__c and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.RegionSGI__c = :this.currentUser.RegionSGI__c and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.Country = :this.currentUser.Country and
											s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.CurrentPeriod__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else
			return;
		doorChartData = mouldingChartData = sheetChartData = otherChartData = null;
		TallyResults (shList);
		MTDTotalSales = totalSales;
		MTDTotalBudget = totalBudget;
		MTDChartData = new List<ChartData>();
		MTDChartData.add (doorChartData);
		MTDChartData.add (mouldingChartData);
		MTDChartData.add (sheetChartData);
		MTDChartData.add (otherChartData);
	}
	private void CalculateYTDSales()
	{
		List<AggregateResult> shList = null;
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerId = :UserInfo.getUserId() and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.OwnerBranch__c = :this.currentUser.Branch__c and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.RegionSGI__c = :this.currentUser.RegionSGI__c and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.Account__r.Owner.Country = :this.currentUser.Country and
											s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			shList = [select sum(s.Sales__c), sum(s.Budget__c), ProductGroupCode__c
										from SalesHistory__c s 
										where s.CurrentYear__c = 'Yes'
										group by s.ProductGroupCode__c];
		}
		else
			return;
		doorChartData = mouldingChartData = sheetChartData = otherChartData = null;
		TallyResults (shList);			
		YTDTotalSales = totalSales;
		YTDTotalBudget = totalBudget;
		YTDChartData = new List<ChartData>();
		YTDChartData.add (doorChartData);
		YTDChartData.add (mouldingChartData);
		YTDChartData.add (sheetChartData);
		YTDChartData.add (otherChartData);
	}
	private void CalculateCollectionSales()
	{
		List<Opportunity> opps = null;
		YTDCollectionSales = 0;
		YTDCollectionBudget = 0;
        List<Account> acct = null;
        YTDCollectionCustSales = 0;
        
        
		if (currentUser.ReportLevel__c == 'Territory Manager')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsClosed = False and Calendar_Year(CloseDate) = 2015
					and OwnerId = :UserInfo.getUserId()];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where OwnerId = :UserInfo.getUserId()];
			YTDCollectionBudget = this.currentUser.X2015_Collections_Budget__c;
		
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where OwnerID = :UserInfo.getUserId() and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
        }
        }
		else if (currentUser.ReportLevel__c == 'Market Manager')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.Branch__c = :currentUser.Branch__c];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.Branch__c = :currentUser.Branch__c];
        
			for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where Branch__c = :currentUser.Branch__c and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
             }
             for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Branch__c = :currentUser.BranchShort__c and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
		}
        }
		else if (currentUser.ReportLevel__c == 'Sales Director')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.RegionSGI__c = :currentUser.RegionSGI__c];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.RegionSGI__c = :currentUser.RegionSGI__c];
            for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where RegionSGI__c = :currentUser.RegionSGI__c and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
            }
             for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Region_SGI__c = :currentUser.RegionSGI__c and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else if (currentUser.ReportLevel__c == 'VP of Sales')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False and Calendar_Year(CloseDate) = 2015
					and Owner.Country = :currentUser.Country];
            acct = [select Id, X2015_Collections_Sales__c 
                    from Account
                    where Owner.Country = :currentUser.Country];
            for (AggregateResult ar : [select Sum(X2015_Collections_Budget__c) from User where Country = :currentUser.Country and IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');

			}
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where Owner_Country__c = :currentUser.Country and X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else if (currentUser.ReportLevel__c == 'Corporate')
		{
			opps = [select Id, CloseDate, CollectionsOpportunityValue__c
					from Opportunity
					where IsCollectionsOpportunity__c = True and IsWon = False  and Calendar_Year(CloseDate) = 2015];
            acct = [select Id, X2015_Collections_Sales__c
                    from Account];			
            for (AggregateResult ar : [select sum(X2015_Collections_Budget__c) from User where IsActive = True and X2015_Collections_Budget__c <> null])
			{
				YTDCollectionBudget = (Decimal) ar.get('expr0');
			}
            for (AggregateResult ar : [select sum(X2015_Collections_Sales__c) from Account where X2015_Collections_Sales__c <> null])
			{
				YTDCollectionCustSales = (Decimal) ar.get('expr0');
			}
		}
		else
			return;
		
        Decimal monthlyBudget;
		if (YTDCollectionBudget > 0)
			monthlyBudget = YTDCollectionBudget / 1;
        else
					monthlyBudget = 0;
        System.Debug ('==monthlyBudget:' + monthlyBudget);
        Decimal custsales;
		if (YTDCollectionCustSales > 0)
			custsales = YTDCollectionCustSales / 1;
		else
					custsales = 0;
        System.Debug ('==custsales:' + custsales);
		CollectionChart = new List<CollectionChartData>();
		CollectionChart.add (new CollectionChartData('J', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('F', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('M', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('A', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('M', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('Jn', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('Jl', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('A', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('S', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('O', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('N', 0, monthlyBudget, custsales));
		CollectionChart.add (new CollectionChartData('D', 0, monthlyBudget, custsales));

               
        for (Opportunity o : opps)
		{
			Integer idx = o.CloseDate.month()-1;
			System.assert(idx >= 0 && idx <= 12);
			CollectionChart[idx].sales += o.CollectionsOpportunityValue__c;
			YTDCollectionSales += o.CollectionsOpportunityValue__c;
			System.debug('==Collection:' + CollectionChart[idx].month + ' $' + CollectionChart[idx].sales);
		}
        
       

		// Remove any months up to the current month with zero value.  Stop at first month
		// found with a zero value.
		Integer currentMonth = Date.today().month()-1;
		System.assert(currentMonth >= 0 && currentMonth < 12);
		for (Integer idx = 11; idx > currentMonth && CollectionChart[idx].sales == 0; idx--)
		{
			CollectionChart.Remove(idx);
		}
	}
	private void TallyResults (List<AggregateResult> results)
	{
		totalSales = totalBudget = 0;
		for (AggregateResult ar : results)		
		{
			String productGroupCode = (String) ar.get('ProductGroupCode__c');
			System.Debug ('==productGroupCode__c:' + productGroupCode + ' Sales:' + ar.get('expr0') + ' Budget:' + ar.get('expr1'));
			if (productGroupCode == 'D')
				doorChartData = new ChartData ('Doors', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'M')
				mouldingChartData = new ChartData ('Mouldings', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'S')
				sheetChartData = new ChartData ('Sheets', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			else if (productGroupCode == 'O')
				otherChartData = new ChartData ('Other', (Decimal) ar.get('expr0'), (Decimal) ar.get('expr1'));
			totalSales += (Decimal) ar.get('expr0');
			totalBudget += (Decimal) ar.get('expr1');
		}
		if (doorChartData == null)
			doorChartData = new ChartData ('Doors', 0, 0);
		if (mouldingChartData == null)
			mouldingChartData = new ChartData ('Mouldings', 0, 0);
		if (sheetChartData == null)
			sheetChartData = new ChartData ('Sheets', 0, 0);
		if (otherChartData == null)
			otherChartData = new ChartData ('Other', 0, 0);
	}
	
	// Container for the chart data
	public class ChartData
	{
        public String name { get; set; }
        public Decimal dataSales { get; set; }
        public Decimal dataBudget { get; set; }


        public ChartData(String name, Decimal sales, Decimal budget)
        {
            this.name = name;
            this.dataSales = sales;
            this.dataBudget = budget;
        }
	}
	public class CollectionChartData
	{
		public String month { get; set; }
		public String year { get; set; }
		public Decimal sales { get; set; }
		public Decimal budget { get; set; }
        public Decimal custsales { get; set; }

		public CollectionChartData(string month, Decimal sales, Decimal budget, Decimal custsales)
		{
			this.month = month;
			this.sales = sales;
			this.budget = budget;
            this.custsales = custsales;
		}
	}
}

 
HI,
 I am new to salesforce, Can any one help me to fix this issue. I am trying to write test class for updating the record using standard controller, and extension .I am getting exception in objAccount , which throws System.QueryException: List has no rows for assignment to SObject.

      I can get the results in query editor by executing 'select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ' this query ,
       
Account objAccount = [select name, owner.name, site ,id, Industry from account where id = '0019000001FYa8GAAT' ];
ApexPages.StandardController sc = new ApexPages.standardController(objAccount);
myPageCon = new AccountEditPageCon(sc);

Please help me to fix this issue. Thanks in advance
 
  • March 09, 2015
  • Like
  • 0
Hi I am uploading a csv file in visual force page and also wants to display the records on page, but while displaying the data i am getting error of regex too complicated or out of bound index. my file contains 32 columns and 834 rows.

Can any one provide me the solution for this.
my apex code is : <apex:page sidebar="true" controller="FileUploader">
   <apex:form >
      <apex:sectionHeader title="Upload data from CSV file"/>
      <apex:pagemessages />
      <apex:pageBlock >
             <center>
              <apex:inputFile value="{!contentFile}" filename="{!nameFile}" /> 
              <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
               </center>  
      
      
      <apex:pageblocktable value="{!uploadedAccounts}" var="acc">
          
              <apex:column value="{!acc.address__c}"/>
          
        
              <apex:column value="{!acc.Bathrooms__c}"/>
          
      
              <apex:column value="{!acc.bedrooms__c}"/>
         
         <apex:column value="{!acc.call_attempt__c}"/>
        
         <apex:column value="{!acc.city__c}"/>
        
         <apex:column value="{!acc.create_date__c}"/>
        
           <apex:column value="{!acc.Full_name__c}"/>
          
            <apex:column value="{!acc.last_call_date__c}"/>
         
         <apex:column value="{!acc.last_call_result__c}"/>
        
         <apex:column value="{!acc.list_agent__c}"/>
         
         
         <apex:column value="{!acc.listing_status__c}"/>
         
          <apex:column value="{!acc.list__c}"/>
         
         
         <apex:column value="{!acc.list_price__c}"/>
         
         
          <apex:column value="{!acc.MLS_ID__c}"/>
                 
          <apex:column value="{!acc.MLS_name__c}"/>
        
         
       <apex:column value="{!acc.notes__c}"/>
       
         <apex:column value="{!acc.phone_1__c}"/>
        
          <apex:column value="{!acc.phone_2__c}"/>
         
          <apex:column value="{!acc.phone_3__c}"/>
       
           <apex:column value="{!acc.property_type__c}"/>
         
          <apex:column value="{!acc.source__c}"/>
   
         
          <apex:column value="{!acc.square_footage__c}"/>
         
             <apex:column value="{!acc.state__c}"/>
      
         
             <apex:column value="{!acc.status_change_date__c}"/>
        
         <apex:column value="{!acc.tax_address__c}"/>
         
         <apex:column value="{!acc.tax_city__c}"/>
       
         
         <apex:column value="{!acc.tax_name__c}"/>
         
         <apex:column value="{!acc.tax_postal_code__c}"/>
                 
         <apex:column value="{!acc.tax_srate__c}"/>
        
         
         
             <apex:column value="{!acc.Zip_code__c}"/>
         
        
        </apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>

and class is :
public class FileUploader 
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    List<real__c> accstoupload;
    
    public Pagereference ReadFile()
    {
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        accstoupload = new List<real__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            real__c a = new real__c();
            a.phone_1__c = inputvalues[0]; 
            a.phone_2__c = inputvalues[1];        
            a.phone_3__c = inputvalues[2];
           accstoupload.add(a);
        }
        try{
        insert accstoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
    
    public List<real__c> getuploadedAccounts()
    {
        if (accstoupload!= NULL)
            if (accstoupload.size() > 0)
                return accstoupload;
            else
                return null;                    
        else
            return null;
    }   
    }