• Kevin Bromer
  • NEWBIE
  • 50 Points
  • Member since 2011

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

Sorry if this is a really basic question, but: I have a trigger, I wrote a test for it, and it is displaying 100% coverage in my Sandbox. I want to deploy it to production, but my overall average coverage is only 72%. I can't deploy unless everything is at 75%, right? The problem is, the code without sufficient coverage is part of managed packages--installed apps. Is it really the case that I have to fix or get rid of other people's mistakes in order to be able to deploy my trigger?

 

I also just downloaded Eclipse with the Force.com IDE. Is that a better way to go to deploy my trigger?

 

Thanks for the help.  

Hi all,

The following code is almost covered but I need some help with covering some of the code that I dont know how to right coverage for.  Below is the class and test class in the class there is reference to disablexxx = true; and xxxQuoteValue = true;  I need to cover these in my test class.  There is an attempt to cover in the test class but something is not written right.

 

Any help would be great.

 

Class:  disableAuto and such refers to items on my vf page.

 

        if(l.Consumer_Products__c == auto)
        {
            disableAuto = true;
            disableHome = true;
            disableUmbrella = true;
            disableBoat = true;
            disableDwellingFire = true;
            disableThirdParty = true;
            autoQuoteValue = true;
        }
        

 

 

test class:  note the "clc.autoQuoteValue = true;"  running test shows that it is not covered.

 

ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertLeadController clc = new ConvertLeadController(sc);
            clc.autoQuoteValue = true;
            clc.boatQuoteValue = true;
            clc.dwellingFireQuoteValue = true;
            clc.homeQuoteValue = true;
            clc.thirdPartyQuoteValue = true;
            clc.convertLead();
            

 Thanks in Advance,

Dwayne

 

Hey all-

 

Have some soql like this:

Opportunity o = [select id (SELECT id from Opportunity.ChildObject__r) from Opportunity limit 1];

 I want to reference the id on the first child object, so I do:

id myid = o.ChildObject__r[0].id;

 However, if there is no ChildObject for Opportunity o, that throws a null reference exception. I tried checking it like this:

if (o.ChildObject__r[0] != null)

 

But that also produces a null reference exception.

I know o exists, and I know there are no ChildObjects for o (for this example).  I'm sure I'm mising something obvious - any thoughts?

Thanks-

 

 

Hey all-


Using the jquery tablesorter plugin with a Visualforce page. Right now, the user clicks the submit button (commandbutton), which renders a VF page block to display the retrieved data in the datatable held within.  I'm far from a jquery guru, and the problem I'm having is that I can only hook the call to the tablesorter function into the 'onclick' attribute of the datatable. I'd like it to be applied as soon as the datatable is rendered for a few reasons:

1. I can presort the elements

2. The late application causes some UI weirdness (overlapping column markers, etc.)

 

Would love any thoughts, I'm a bit stumped on the best approach here.  The sorting works fine incidentally, its just ugly and not loaded until a user click.  Here's the relevant bits of code (jq = $):

 

JS: 

<script type="text/javascript">
    
 function sortThis() {
         jq(".tablesorter").tablesorter(
         {
        sortClassAsc: 'headerSortUp',   
        sortClassDesc: 'headerSortDown',
        headerClass: 'header',          
         stripingRowClass: ['even','odd'],        stripeRowsOnStartUp: true         
         });
   };    
    </script>

 And the VF:

 

 <apex:form >
    <apex:pageBlock id="tableblock" rendered="{!RenderDataTable}">
<div style="height:450px; width:900px; overflow:hidden;" id="checkInList"><div style="height:440px; overflow:auto" id="tableContainer">
        <apex:PageBlockSection title="Partner Results" collapsible="false" onclick="sortThis()">
<apex:DataTable width="90%" styleClass="tablesorter" id="PartnerDataTable" value="{!PartnerDeals}" var="pdeal" rendered="{!RenderDataTable}">
    

//REST OF TABLE RENDERED HERE 

 


Thanks!

 

Hey all-

 

Have some soql like this:

Opportunity o = [select id (SELECT id from Opportunity.ChildObject__r) from Opportunity limit 1];

 I want to reference the id on the first child object, so I do:

id myid = o.ChildObject__r[0].id;

 However, if there is no ChildObject for Opportunity o, that throws a null reference exception. I tried checking it like this:

if (o.ChildObject__r[0] != null)

 

But that also produces a null reference exception.

I know o exists, and I know there are no ChildObjects for o (for this example).  I'm sure I'm mising something obvious - any thoughts?

Thanks-

 

 

Hey all-


Using the jquery tablesorter plugin with a Visualforce page. Right now, the user clicks the submit button (commandbutton), which renders a VF page block to display the retrieved data in the datatable held within.  I'm far from a jquery guru, and the problem I'm having is that I can only hook the call to the tablesorter function into the 'onclick' attribute of the datatable. I'd like it to be applied as soon as the datatable is rendered for a few reasons:

1. I can presort the elements

2. The late application causes some UI weirdness (overlapping column markers, etc.)

 

Would love any thoughts, I'm a bit stumped on the best approach here.  The sorting works fine incidentally, its just ugly and not loaded until a user click.  Here's the relevant bits of code (jq = $):

 

JS: 

<script type="text/javascript">
    
 function sortThis() {
         jq(".tablesorter").tablesorter(
         {
        sortClassAsc: 'headerSortUp',   
        sortClassDesc: 'headerSortDown',
        headerClass: 'header',          
         stripingRowClass: ['even','odd'],        stripeRowsOnStartUp: true         
         });
   };    
    </script>

 And the VF:

 

 <apex:form >
    <apex:pageBlock id="tableblock" rendered="{!RenderDataTable}">
<div style="height:450px; width:900px; overflow:hidden;" id="checkInList"><div style="height:440px; overflow:auto" id="tableContainer">
        <apex:PageBlockSection title="Partner Results" collapsible="false" onclick="sortThis()">
<apex:DataTable width="90%" styleClass="tablesorter" id="PartnerDataTable" value="{!PartnerDeals}" var="pdeal" rendered="{!RenderDataTable}">
    

//REST OF TABLE RENDERED HERE 

 


Thanks!

 

Hi All,

I am trying to update a Lookup Field on an Account with a Trigger.  Essentially I have a Custom Object (Box_Assumptions_c) related to an Account (Account1) and I want to update an a Custom Field (X9Box_Assumptions__c) on a different Account (Account2) with a Box Assumption that is related to Account1 by using the Owner's (Portal User) Contact Account (Account1).

 

trigger updatecustomer9box on Account (before insert, before update) {
    
    //Get Account ID of the current record.
    set<id> acctid = new set<id>();
    for (account a : trigger.new)
    acctid.add(a.owner.contact.account.id);
    
    map<id, box_assumptions__c> boxmap = new map<id, box_assumptions__c>([select id 
                                                                     from box_assumptions__c
                                                                     where account__c in : acctid]);
    for (account a : trigger.new){
        box_assumptions__c thisbox = boxmap.get(a.x9box_assumptions__c);
        a.x9box_assumptions__c = thisbox.id;
    }
}

 I am getting a Null Pointer Exception so any advice would be helpful!

 

-Thanks in advance!

 

I want it that I have one picklist field & I want its selected value on controller as String format so how can I do this ?

I have created bean for it also but this field is custom field of my custom bject Income__c & there are lots of field & I can't create getter setter method for each field so that i created bean for entire object so that its field value will also be acceessible but the problem is that how to access this field value also..

I tried this also

 

String name = beanInstance.Income__c.Income_class__c.value;

String name = beanInstance.Income__c.Income_class__c;

 

But both are not working in my controller....

Please reply soon..

Regards...

I'm working on a [soon to be open-sourced] application configuration object that allows an application to programmatically check for a specific custom setting and load a default value from a file if it hasn't been set.  To that end, I've got a constructor for this class that requires a custom settings object and a string to pass to getValues() on that object.

 

Unfortunately, when I attempt to call getInstance() on the object (which I've tried using both SObject and Object s the primitive for), the Force.com IDE gives me a save error.  I'd really appreciate any insight into what the correct primitive type would be for this object (hopefully there's an undocumented primitive that has getInstance(string) defined on it?).

 

The errors I get are below - I get a similar error if I use getValues() instead of getInstance():

Save error: Method does not exist or incorrect signature: [SObject].getInstance(string)

or

Save error: Method does not exist or incorrect signature: [Object].getInstance(string)

 

The constructor in question is pretty simple (see below), with the error appearing on line 2 of 2 in the method body.  Both lines are assigning values to private instance variables for use by other methods in the class.

The constructor:

 

<code> 

    public ApplicationConfigurator( String defaultConfigurationResourceName,

 Object systemConfigurationObject,

 String systemConfigurationInstanceName)

    {

 defaultConfigurationFileResource = defaultConfigurationResourceName;

 systemConfigInstance = systemConfigurationObject.getValues(systemConfigurationInstanceName);

    }

</code>

Hi,

 

how do i generate dynamic xml in sfdc to post to a url to generate pdf with populating current account fields.

 

 

Thanks

  • June 01, 2011
  • Like
  • 0

Can salesforce partner wsdl be used to make API calls from one org to other?

Sorry if this is a really basic question, but: I have a trigger, I wrote a test for it, and it is displaying 100% coverage in my Sandbox. I want to deploy it to production, but my overall average coverage is only 72%. I can't deploy unless everything is at 75%, right? The problem is, the code without sufficient coverage is part of managed packages--installed apps. Is it really the case that I have to fix or get rid of other people's mistakes in order to be able to deploy my trigger?

 

I also just downloaded Eclipse with the Force.com IDE. Is that a better way to go to deploy my trigger?

 

Thanks for the help.  

Hi all,

The following code is almost covered but I need some help with covering some of the code that I dont know how to right coverage for.  Below is the class and test class in the class there is reference to disablexxx = true; and xxxQuoteValue = true;  I need to cover these in my test class.  There is an attempt to cover in the test class but something is not written right.

 

Any help would be great.

 

Class:  disableAuto and such refers to items on my vf page.

 

        if(l.Consumer_Products__c == auto)
        {
            disableAuto = true;
            disableHome = true;
            disableUmbrella = true;
            disableBoat = true;
            disableDwellingFire = true;
            disableThirdParty = true;
            autoQuoteValue = true;
        }
        

 

 

test class:  note the "clc.autoQuoteValue = true;"  running test shows that it is not covered.

 

ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertLeadController clc = new ConvertLeadController(sc);
            clc.autoQuoteValue = true;
            clc.boatQuoteValue = true;
            clc.dwellingFireQuoteValue = true;
            clc.homeQuoteValue = true;
            clc.thirdPartyQuoteValue = true;
            clc.convertLead();
            

 Thanks in Advance,

Dwayne

 

Hi!

 

I'm trying to deploy an Apex app i developed, and for that i covered 78% of my code with tests (trying to get to 100% :D).

But every time i try to deploy, an error message appears:

 

Apex Class    My Class    No testMethods found in the selected Apex code for the package

 

And that's not true, because if i click on My Class link, it shows that this class has 100% of coverage.

 

Is this happening because instead of testing my classes on the same apex class, i'm using separated classes for each test?

(like, for MyClassController.cls i have a MyClassControllerTest.cls that is a private class with @isTest).