• robert webber 8
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 11
    Replies
I am getting this error on a class that has 76% coverage when I try to upload my package. Overall I have 80% coverage. This was a class that had zero coverage on my first attempt. I created the unit test in one of my unit test classes. I thought that would fix it, but I still get the error even though it shows 76% coverage when I run all. Any ideas? I am currently blocked from uploading the package.
Can you use the new stripInaccessible to avoid all the individual field checks requried to pass the security review, like shown below? This has always been a big hassle. If so, can someone give me an example?

Thanks


List<String> checkFields3 = new List<String>            {'ProjectionDate__c','InvestmentPlanID__c','InvestmentID__c','CombineResources__c'};
Map<String,Schema.sObjectField> m3 = Schema.SObjectType.Investment_Summary_Data__c.Fields.getMap();
        for(String f:checkFields3) {
            if(!m3.get(npPfx+f).getDescribe().isCreateable() || !m3.get(npPfx+f).getDescribe().isUpdateable()) {
'+m3.get(npPfx+f).getDescribe().isCreateable());
                throw new MyException('Contact administrator - you do not have permission to create Investment Summary Data');
            }
        } //end fls create check



 
Checkpoints don't fire when set in a unit test method or any method called by a unit test method. It was working a few weeks ago and it just stopped working. They work if I invoke code from the app UI. Not sure if it has anything to do with it, but I create a role as administrator in the test setup and do a RunAs this administrator, but this hasn't changed.

Below is my log level setup. Doesn't make any difference if I set to Finer or Finest.

Any ideas?

Change Log Level setup

 
I have a VF page that opens from an output link:

                <apex:column headervalue="Title" width="50%">
                    <apex:outputLink value="/apex/WorkRequestVF?ID={!w.WorkItemID}">
                        {!w.WorkItemName}
                    </apex:outputLink>
                </apex:column>

Within the WorkRequestVF child page I want to save and refresh the parent page.

                <apex:commandButton value="Save" action="{!MySave}" oncomplete="closeWin();" style="width:150px"/>

MySave in the controller does error checks and then does an update on the record, then returns null.

Here is the VF javascript function:

function closeWin(){   
        if(window.parent){
            window.parent.opener.location.href = window.parent.opener.location.href;
            window.parent.close();
        }  
        else{
            window.opener.location.href = window.opener.location.href;
            window.close();  
        }  
    }

This all works fine except for the case where there are ApexPages:message error messages added. The window closes before any of the error messages can be seen.

My requirement is that I want to be able to open the linked record from the parent page. When there are no errors I want to update the record, close the child page and refresh the parent page. If there are error messages, I want to stay on the page and show the error messages. How can I do this? Any help greatly appreciated.
 
I'm using the Lightning style sheets with my Visualforce pages. All error messages come out in the ApexPages.severity.ERROR format, regardless of the severity setting. Example below. It comes out in INFO format if I turn off Lightning Experience. If I turn it on, it comes out in the red ERROR format. Any ideas?

            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Projection complete'));        

 
Running VF pages under Lightning. My page has tabs. The tabs change color after any partial page refresh. Below are before and after. Any ideas? Doesn't occur if I run under Classic.

Before:

User-added image

After:

User-added image


 
I want to call a controller method after the user changes a value in a pageBlockTable and then hits enter.  The table is within a pageBlock (not pageBlockSection). I tried this on one of the columns but it doesn't invoke "PlanSalesProfileChange". Any ideas? The table is within an apex:tab but I don't think that would make any difference. I tried it without using the formatting and param but it doesn't make any difference.

<apex:column headerValue="Year 1">
    <apex:outputText value="{0,number,#,###}">
       <apex:param value="{!f.Year1__c}"/>
        <apex:actionSupport event="onchange" action = {!PlanSalesProfileChange}" rerender="idSalesSlider,idPlanProfile,idPlanSales"/>                                      
    </apex:outputText>                                                
</apex:column>                                



 
I've spent hours trying to solve this. I've boiled it down to the following VF test page below. When I change the "Plan" selectList and there is no data, the pageBlockSection is not supposed to render since SalesInvestmentPlanData.HavePlan1Data and SalesInvestmentPlanData.HavePlan2Data are false. "UpdateDashboard" runs from the constructor, and also when the Plan selectList changes. I set HavePlan1Data and HavePlan2Data to false in the test code that runs in the controller shown below the VF. When the page loads, the pageBlockSection is not rendered, which is what I expect. When I change the Plan selectList, I get the error "Expected at least 1 rendered series component", implying that the pageBlockSection is rendering  but the Line Series are not rendering. Presume this is something obvious but just can't see why the pageBlock is rendered on the selectList change when HavePlan1Data and HavePlan2Data are hard-coded to false.  Greatly appreciate help on this.  PS I put this in a panelgrid because there are more charts in the original VF page. Thanks.

<apex:page StandardController="Investment_Plan__c" extensions="FinancialDashboardControllerTest" sidebar="False" LightningStyleSheets="True">
    
    <apex:pageBlock >
        <apex:form >
            <apex:pageBlockSection collapsible="False" columns="2">               
                <apex:selectList value="{!selectedOption}" size="1" label="Plan 1">
                    <apex:actionSupport event="onchange" action="{!UpdateDashboard}" rerender="idSelectedResourceScenario,idSelectedDate,idFinancialData"/>
                    <apex:selectOptions value="{!selectPlanOptions}"/>
                </apex:selectList>               
                <apex:selectList value="{!selectedResourceScenario}" size="1" label="Resource Scenario" id="idSelectedResourceScenario">
                    <apex:actionSupport event="onchange" action="{!UpdateDashboard}" reRender="idSelectedDate,idFinancialData"/>                    
                    <apex:selectOptions value="{!selectedResourceScenarioOptions}"/>
                </apex:selectList>               
                <apex:selectList value="{!selectedDate}" size="1" label="Projection Date" id="idSelectedDate">
                    <apex:actionSupport event="onchange"  rerender="idCharts"/>                    
                    <apex:selectOptions value="{!selectedDates}"/>
                </apex:selectList>               
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>   
    <apex:pageBlock>
        <apex:pageBlockSection columns="1" id="idFinancialData" rendered="{!If(SalesInvestmentPlanData.HavePlan1Data || SalesInvestmentPlanData.HavePlan2Data,'True','False')}">
            <apex:messages/>
            <apex:panelGrid columns="1" id="idCharts">               
                <apex:outputPanel>                                        
                    <apex:chart height="300" width="510" data="{!SalesInvestmentPlanData.PlanData}">
                        <apex:legend position="bottom"/>
                        <apex:axis type="Numeric" position="left" fields="data1" minimum="0" maximum="{!SalesInvestmentPlanData.MaxPlanData}"/>   
                        <apex:axis type="Category" position="bottom" fields="name" >
                        </apex:axis>
                        <apex:lineSeries axis="left" xField="name" yField="data1" title="Plan 1"
                                         markerType="cross" markerSize="4" markerFill="#FF0000" rendered="{!If(SalesInvestmentPlanData.HavePlan1Data,'True','False')}"/>
                        <apex:lineSeries axis="left" xField="name" yField="data2" title="Plan 2"
                                         markerType="circle" markerSize="4" markerFill="#8E35EF" rendered="{!If(SalesInvestmentPlanData.HavePlan2Data,'True','False')}"/>           
                    </apex:chart>                                                        
                </apex:outputPanel>               
           </apex:panelGrid>
        </apex:pageBlockSection>
    </apex:pageBlock>   
</apex:page>

"Update Dashboard"
    public pageReference UpdateDashboard() {
        salesReturnData.HavePlan1Data = False;
        salesReturnData.HavePlan2Data = False;
        return null;
        }






 
Suddenly I cannot save changes to Apex code or VF pages from the Developer Console. It just hangs up. If I wait long enough, sometimes 5 - 10 minutes, it will save. This makes the developer console impractical to use. I read through the forums and found some advice about creating a new workspace, which I've done twice, but it hasn't helped. Appreciate any help on this. I'm stuck not using the Developer Console right now and I have some deadlines coming up.
I'm trying to create a simple multiselect list using the example in the developer guide. There are no checkboxes displayed. I just get a list of the select options but can't select anything. If I click on any value, it is highlighted, but only one at a time.

My VF and controller are below. Help anyone? It seems this should be simple. Have spent several hours trying to get it to work.

<apex:page standardController="Planning_Object__c" extensions="PlanningObjectControllerExt" LightningStyleSheets="True">
    <apex:form >
        <apex:selectList multiselect="true" value="{!SelectedTypeOptions}" label="Object Type">
            <apex:selectOptions value="{!Types}"/>
        </apex:selectList>
    </apex:form>
</apex:page>

Controller:

public with sharing class PlanningObjectControllerExt {
     public List<SelectOption> PLOptions = new List<SelectOption>();
     public String SelectedPL{get;set;}
     public List<SelectOption> planningOptionTypes = new List<SelectOption>();
    String[] selectedTypeOptions = new String[]{};
     
    public ApexPages.StandardController controller;
    ID objectID = System.currentPagereference().getParameters().get('ID');
    //constructor
    public PlanningObjectControllerExt(ApexPages.StandardController standardController) {
        this.controller = controller;
        Schema.DescribeFieldResult fieldResult = Planning_Object__c.Type__c.getDescribe();
        List<Schema.PicklistEntry> options = fieldResult.getPickListValues();
        
        for(Schema.PicklistEntry s:options) {
            planningOptionTypes.add(new SelectOption(s.getLabel(),s.getValue()));            
        }
    } //end controller
    
    
    public List<SelectOption> getTypes() {
        return planningOptionTypes;
    }
    
    public String[] getSelectedTypeOptions() {
        return selectedTypeOptions;
    }  
    
    public void setSelectedTypeOptions(String[] selectedTypeOptions) {
        this.selectedTypeOptions = selectedTypeOptions;
    }
 
}


 
When I create a filter on the list view of a custom object, I can select from values that are defined in a picklist on that object. However, when I try to filter with a lookup field on that object, it doesn't show values to select from. I  have to enter the values from memory. Is there a way to filter on the name or other field in a lookup object?
I moved to Lightning and created a new home page that includes both Chatter Publisher and Chatter Feed. When I post anything in Chatter Publisher, it disappears and I see nothing in either Publisher of Feed. Is there some setting that needs to be changed? Used to work in Classic.
Is it possible to display only a segment of a line in a VisualForce chart? I have a bar series and line series on the same chart. Say I want the line to start at the position of the 2nd bar (no line data point above the 1st bar). I have tried setting data1, the first value of the line series, to null, and nothing displays. If I set it to zero, I get a line from zero to the position of the 2nd line data point. Anyone know how to do this? I am using SalesForce Classic. 
I am getting this error on a class that has 76% coverage when I try to upload my package. Overall I have 80% coverage. This was a class that had zero coverage on my first attempt. I created the unit test in one of my unit test classes. I thought that would fix it, but I still get the error even though it shows 76% coverage when I run all. Any ideas? I am currently blocked from uploading the package.
Can you use the new stripInaccessible to avoid all the individual field checks requried to pass the security review, like shown below? This has always been a big hassle. If so, can someone give me an example?

Thanks


List<String> checkFields3 = new List<String>            {'ProjectionDate__c','InvestmentPlanID__c','InvestmentID__c','CombineResources__c'};
Map<String,Schema.sObjectField> m3 = Schema.SObjectType.Investment_Summary_Data__c.Fields.getMap();
        for(String f:checkFields3) {
            if(!m3.get(npPfx+f).getDescribe().isCreateable() || !m3.get(npPfx+f).getDescribe().isUpdateable()) {
'+m3.get(npPfx+f).getDescribe().isCreateable());
                throw new MyException('Contact administrator - you do not have permission to create Investment Summary Data');
            }
        } //end fls create check



 
Checkpoints don't fire when set in a unit test method or any method called by a unit test method. It was working a few weeks ago and it just stopped working. They work if I invoke code from the app UI. Not sure if it has anything to do with it, but I create a role as administrator in the test setup and do a RunAs this administrator, but this hasn't changed.

Below is my log level setup. Doesn't make any difference if I set to Finer or Finest.

Any ideas?

Change Log Level setup

 
I have a VF page that opens from an output link:

                <apex:column headervalue="Title" width="50%">
                    <apex:outputLink value="/apex/WorkRequestVF?ID={!w.WorkItemID}">
                        {!w.WorkItemName}
                    </apex:outputLink>
                </apex:column>

Within the WorkRequestVF child page I want to save and refresh the parent page.

                <apex:commandButton value="Save" action="{!MySave}" oncomplete="closeWin();" style="width:150px"/>

MySave in the controller does error checks and then does an update on the record, then returns null.

Here is the VF javascript function:

function closeWin(){   
        if(window.parent){
            window.parent.opener.location.href = window.parent.opener.location.href;
            window.parent.close();
        }  
        else{
            window.opener.location.href = window.opener.location.href;
            window.close();  
        }  
    }

This all works fine except for the case where there are ApexPages:message error messages added. The window closes before any of the error messages can be seen.

My requirement is that I want to be able to open the linked record from the parent page. When there are no errors I want to update the record, close the child page and refresh the parent page. If there are error messages, I want to stay on the page and show the error messages. How can I do this? Any help greatly appreciated.
 
I've spent hours trying to solve this. I've boiled it down to the following VF test page below. When I change the "Plan" selectList and there is no data, the pageBlockSection is not supposed to render since SalesInvestmentPlanData.HavePlan1Data and SalesInvestmentPlanData.HavePlan2Data are false. "UpdateDashboard" runs from the constructor, and also when the Plan selectList changes. I set HavePlan1Data and HavePlan2Data to false in the test code that runs in the controller shown below the VF. When the page loads, the pageBlockSection is not rendered, which is what I expect. When I change the Plan selectList, I get the error "Expected at least 1 rendered series component", implying that the pageBlockSection is rendering  but the Line Series are not rendering. Presume this is something obvious but just can't see why the pageBlock is rendered on the selectList change when HavePlan1Data and HavePlan2Data are hard-coded to false.  Greatly appreciate help on this.  PS I put this in a panelgrid because there are more charts in the original VF page. Thanks.

<apex:page StandardController="Investment_Plan__c" extensions="FinancialDashboardControllerTest" sidebar="False" LightningStyleSheets="True">
    
    <apex:pageBlock >
        <apex:form >
            <apex:pageBlockSection collapsible="False" columns="2">               
                <apex:selectList value="{!selectedOption}" size="1" label="Plan 1">
                    <apex:actionSupport event="onchange" action="{!UpdateDashboard}" rerender="idSelectedResourceScenario,idSelectedDate,idFinancialData"/>
                    <apex:selectOptions value="{!selectPlanOptions}"/>
                </apex:selectList>               
                <apex:selectList value="{!selectedResourceScenario}" size="1" label="Resource Scenario" id="idSelectedResourceScenario">
                    <apex:actionSupport event="onchange" action="{!UpdateDashboard}" reRender="idSelectedDate,idFinancialData"/>                    
                    <apex:selectOptions value="{!selectedResourceScenarioOptions}"/>
                </apex:selectList>               
                <apex:selectList value="{!selectedDate}" size="1" label="Projection Date" id="idSelectedDate">
                    <apex:actionSupport event="onchange"  rerender="idCharts"/>                    
                    <apex:selectOptions value="{!selectedDates}"/>
                </apex:selectList>               
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>   
    <apex:pageBlock>
        <apex:pageBlockSection columns="1" id="idFinancialData" rendered="{!If(SalesInvestmentPlanData.HavePlan1Data || SalesInvestmentPlanData.HavePlan2Data,'True','False')}">
            <apex:messages/>
            <apex:panelGrid columns="1" id="idCharts">               
                <apex:outputPanel>                                        
                    <apex:chart height="300" width="510" data="{!SalesInvestmentPlanData.PlanData}">
                        <apex:legend position="bottom"/>
                        <apex:axis type="Numeric" position="left" fields="data1" minimum="0" maximum="{!SalesInvestmentPlanData.MaxPlanData}"/>   
                        <apex:axis type="Category" position="bottom" fields="name" >
                        </apex:axis>
                        <apex:lineSeries axis="left" xField="name" yField="data1" title="Plan 1"
                                         markerType="cross" markerSize="4" markerFill="#FF0000" rendered="{!If(SalesInvestmentPlanData.HavePlan1Data,'True','False')}"/>
                        <apex:lineSeries axis="left" xField="name" yField="data2" title="Plan 2"
                                         markerType="circle" markerSize="4" markerFill="#8E35EF" rendered="{!If(SalesInvestmentPlanData.HavePlan2Data,'True','False')}"/>           
                    </apex:chart>                                                        
                </apex:outputPanel>               
           </apex:panelGrid>
        </apex:pageBlockSection>
    </apex:pageBlock>   
</apex:page>

"Update Dashboard"
    public pageReference UpdateDashboard() {
        salesReturnData.HavePlan1Data = False;
        salesReturnData.HavePlan2Data = False;
        return null;
        }






 
Suddenly I cannot save changes to Apex code or VF pages from the Developer Console. It just hangs up. If I wait long enough, sometimes 5 - 10 minutes, it will save. This makes the developer console impractical to use. I read through the forums and found some advice about creating a new workspace, which I've done twice, but it hasn't helped. Appreciate any help on this. I'm stuck not using the Developer Console right now and I have some deadlines coming up.
I moved to Lightning and created a new home page that includes both Chatter Publisher and Chatter Feed. When I post anything in Chatter Publisher, it disappears and I see nothing in either Publisher of Feed. Is there some setting that needs to be changed? Used to work in Classic.
Is it possible to display only a segment of a line in a VisualForce chart? I have a bar series and line series on the same chart. Say I want the line to start at the position of the 2nd bar (no line data point above the 1st bar). I have tried setting data1, the first value of the line series, to null, and nothing displays. If I set it to zero, I get a line from zero to the position of the 2nd line data point. Anyone know how to do this? I am using SalesForce Classic.