• pcave
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies

I've created a class that is used to insert a new account when a contact is created (via a before insert trigger on the contact object). It works, however it will not pass testing because of the query (I think) I am using in the test method. What is the best way to test that the account was created successfully?

 

static testMethod void validateNewContactWithNewAccount() {
        Contact c = new Contact();
        c.firstname = 'Phillip';
        c.lastname = 'Cave';
        c.Temp_Organization_Name__c = 'Jackson River';
        c.Temp_Address_Line_1__c = '129 Bally Shannon Way';
        c.Temp_City__c = 'Apex';
        c.Temp_State__c = 'NC';
        c.Temp_Zip_Code__c = '27539';
        c.Temp_Overview__c = 'This is the organization overview';
        c.Temp_Website__c = 'http://www.jacksonriver.com';
        //c.Organization_Type__c = 'Pimphouse';
       
        // test our insert trigger
        insert c;
       
        Account b = [select id, name, shippingstreet, shippingcity from account where id = :c.accountid];
       
        System.assertEquals(b.id, c.accountid);
        System.assertEquals('Jackson River', b.name);
        System.assertEquals('129 Bally Shannon Way', b.ShippingStreet);
        System.assertEquals('Apex', b.ShippingCity);
    }

  • September 25, 2009
  • Like
  • 0

I'm writing some apex code that needs to check to see if a contact has an account assigned via the AccountId field. Do I need to check for an empty or null value? as in?

 

 if (c.AccountId != NULL)

 

or

 

if (c.Account != '')

 

Thanks,

Phillip

  • September 24, 2009
  • Like
  • 1

Hello, I'm doing some intergartion work through the salesforce api and I recently got the following warning.

 

Operation: insert.npe03__Recurring_Donation__c

By user/organization: 00580000001snmg/00D80000000cnJ5

Caused the following Apex resource warnings:

npe03:Number of DML rows: 128 out of 200

 

I'm not really sure what this means as I know I'm not doing 128 inserts at once.

 

Does the 200 limit apply to a certain timespan?

 

Any help is appreciated. 

 

Thanks,

Phillip

  • September 09, 2009
  • Like
  • 0

I'm writing some apex code that needs to check to see if a contact has an account assigned via the AccountId field. Do I need to check for an empty or null value? as in?

 

 if (c.AccountId != NULL)

 

or

 

if (c.Account != '')

 

Thanks,

Phillip

  • September 24, 2009
  • Like
  • 1