function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nwingnwing 

Help - Issue With This - System.Exception: Assertion Failed: Expected: 3861.8125, Actual: null

I successfully wrote a class to update a date field, and used that to build a class that updates a number field, both on a before insert/before update trigger.
 
The date one works great.  The number class worked, and then didn't, but it was working in a dev environment at one time, though I could not get it to deploy to server.  I cannot find for the life of me what is going on.  It runs the test and tells me that the Actual is null in the assertion.
 
Here is the class as well as the code.  If there is ANY suggestions please!  Basically, I am using four values, 'months' , 'initial rent' , and 'percent increase', and 'escalation month' to determine the total cost of a lease agreement.  The escalation month is the month in which the rent goes up each 12 month cycle, by the 'percent increase' amount.
 
As I said this was working, but ever since I tried to deploy it it is choking now.  I have a separate trigger for each class, both with the same parameters, but the other one launches the date update class, which is working fine.  They are very similar in structure.  In fact I used the date one as a model to help build the number update.....
 
Code:
trigger SiteLeaseCumCostTrigger on Site_Lease_Contract__c (before insert, before update) {

 SiteLeaseCumCostClass.SiteLeaseCumCostTrigger( Trigger.new );

}

 
 
 
 
Code:
public class SiteLeaseCumCostClass {
 
public static void SiteLeaseCumCostTrigger(Site_Lease_Contract__c[] newSiteLeaseCumCost) {
  for (Integer i = 0; i < Trigger.new.size(); i++) {
   
   Double mthsD = newSiteLeaseCumCost[i].Lease_Term_In_Months__c;
   Double escmthD = newSiteLeaseCumCost[i].Escalation_Month__c;
   
   Integer mths = mthsD.intValue();
   Integer escmth = escmthD.intValue();
   
   Double trm1cost = (escmth-1) * newSiteLeaseCumCost[i].Initial_Rent__c;
   Double numflltrmsD = math.floor(((mthsD-(escmthD-1))/12));
   Integer numflltrms = numflltrmsD.intValue();
   Integer lsttrm = mths - ((numflltrms * 12) + (escmth-1));
   
   Double trm2cost = 0;
   Double escpct = newSiteLeaseCumCost[i].Escalation_Amount__c/100;
   Integer k;
   
   Double intrnt = newSiteLeaseCumCost[i].Initial_Rent__c;
   
   for (Integer j = 1; j < numflltrms+1;j++) {
    trm2cost = 12*(math.pow(1+escpct,j)*intrnt) + trm2cost;
    k=j;
   }
   
   k = k+1;
   
   Double trm3cost = (12-(escmth-1))*(math.pow(1+escpct,k)*intrnt);
   Double alltrmcost = trm1cost + trm2cost + trm3cost;
   
      newSiteLeaseCumCost[i].Cum_Cost__c = alltrmcost;
  }   
 }
   
 static testMethod void SiteLeaseCumCostTrigger(){
  
  double cst0 = 3861.8125;
  Site_Lessor__c lessor = new Site_Lessor__c(Name='Testing2');
  insert lessor;

  Site_Lease_Contract__c t = new Site_Lease_Contract__c(Site_Lessor__c=lessor.Id,Name='Name1',Lease_Term_In_Months__c=36,Escalation_Month__c=8,Initial_Rent__c=100.00,Escalation_Amount__c=5.00);
  insert t;
  
  Site_Lease_Contract__c testCumCost1=[select id, Cum_Cost__c from Site_Lease_Contract__c where id = :t.Id];
  
  system.assertEquals(cst0,testCumCost1.Cum_Cost__c);

 }
}

 
nwingnwing

 

btw, this is working perfectly in the test system now.  It saves to the test environment just fine, even though it errors out when running the test method and will not deploy to the prod environment.

aaarrgghhh!

nwingnwing
 
so please help..... I am missing something simple here I am sure.....but this is killing me
JimRaeJimRae
Are you sure that your testmethod is actually inserting everything, and then retrieving a record?  If it was not, that could be why your actual was a null instead of a value.
Your system log should show you the result of the query, "retrieved x records" sort of thing.

Code:
Static testMethod void SiteLeaseCumCostTrigger(){
  
  double cst0 = 3861.8125;
  String tid='';
  Site_Lessor__c lessor = new Site_Lessor__c(Name='Testing2');
  try{ 
       insert lessor;
  }catch(DMLException e){
       system.debug('ERROR INSERTING LESSOR:'+e.getDMLMessage(0));
  }

  Site_Lease_Contract__c t = new Site_Lease_Contract__c(Site_Lessor__c=lessor.Id,Name='Name1',Lease_Term_In_Months__c=36,Escalation_Month__c=8,Initial_Rent__c=100.00,Escalation_Amount__c=5.00);
  try{
       insert t;
       tid=t.id;//this will capture the id of the inserted contract if the insert is successful

  }catch(DMLException e){
       system.debug('ERROR INSERTING CONTRACT:'+e.getDMLMessage(0));
  }

  Site_Lease_Contract__c testCumCost1=[select id, Cum_Cost__c from Site_Lease_Contract__c where id = :tid];

  system.debug('\n\nTest Contract Result:'+testCumCost1);//will show if anything was retrieved or not

  system.assertEquals(cst0,testCumCost1.Cum_Cost__c);

 }
}

 

nwingnwing

 

Thank You Very Much!  I will put this into action and see what I can do with it.  It rolls up into, and works great, in the dev environment, so that would make sense.

nwingnwing
Sheesh, I did find a couple issues with your help above.  One was that it wouldn't allow me to insert a new contract with an Id value for the master object "Lease Owner"........which it should as that is not the id of the record, but of the lookup/master object....so I am not sure why that caused an issue, but I removed that and made it a non-required lookup and that cleared up.
 
Second, on the query line I had '  :t.Id'  instead of ':t.id'.......which might have been an issue.....not sure at this point but............
 
finally after clearing up those two I thougth I had it.  But, like I said, it tests fine, uploads to and works in the dev environment just fine, but when I try deploy it to the production server is still gives me the 'assertion fails, expected = 3456.6543, actual:null' problem........
 
When I 'Run Tests', which are successful, the log gives me the below (I just took the part out that seemed pertinent....)
Code:
20081217225737.124:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 66, column 45: SOQL query with 1 row finished in 8 ms
20081217225737.124:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 66, column 9:     initial value: Site_Lease_Contract__c:{Cum_Cost__c=3861.8125, Id=a018000000Lr8Z6AAJ}
20081217225737.124:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9: system.debug(String)
20081217225737.124:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9: 

Test Contract Result:Site_Lease_Contract__c:{Cum_Cost__c=3861.8125, Id=a018000000Lr8Z6AAJ}
20081217225737.124:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 70, column 9: system.assertEquals(Decimal, Decimal)
20081217225737.124:Class.SiteLeaseCumCostClass: line 46, column 28:     returning from end of method static testMethod void SiteLeaseCumCostTrigger() in 90 ms

 so the return is working, and the numbers match up, but when I deploy it chokes.....I am befuddled.........any ideas?  It is better, but no cigar quite yet....
 
thanks,

 
 
 
kevinbnpowerkevinbnpower
How about the deploy log, can you post that?
nwingnwing
Is this what you are asking for?  Thanks! 
 
*** Deployment Log ***
Result: FAILED
Date: December 17, 2008 4:45:23 PM PST
# Deployed From:
   Project name: SiteLeaseCumCostUpdate
   Username: blah
   Endpoint: www.salesforce.com
# Deployed To:
   Username: blah
   Endpoint: www.salesforce.com
# Deploy Results:
   Name:    classes/SiteLeaseCumCostClass.cls
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a
   Name:    package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a
# Test Results:
Run Failures:
  SiteLeaseCumCostClass.SiteLeaseCumCostTrigger System.Exception: Assertion Failed: Expected: 3861.8125, Actual: null
  Average test coverage across all Apex Classes and Triggers is 50%, at least 75% test coverage is required
nwingnwing
Here is the debug Log.........
 
 
*** Beginning Test 1: firstclass.static testMethod void testTestRepeat()
20081218004520.788:Class.firstclass: line 1, column 8: Static initialization: firstclass
20081218004520.788:Class.firstclass.testTestRepeat: line 33, column 9: DeclareVar: firstclass trTest
20081218004520.788:Class.firstclass: line 1, column 14: Instance initialization: firstclass
20081218004520.788:Class.firstclass.testTestRepeat: line 33, column 9:     initial value: firstclass:[]
20081218004520.788:Class.firstclass.testTestRepeat: line 34, column 9: system.assertEquals(String, String)
20081218004520.788:Class.firstclass.testRepeat: line 4, column 5: For
20081218004520.788:Class.firstclass.testRepeat: line 4, column 10: DeclareVar: Integer i
20081218004520.788:Class.firstclass.testRepeat: line 4, column 10:     initial value: 0
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: system.debug(String)
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: Execution 0
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: system.debug(String)
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: Execution 1
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: system.debug(String)
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: Execution 2
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: system.debug(String)
20081218004520.788:Class.firstclass.testRepeat: line 5, column 9: Execution 3
20081218004520.788:Class.firstclass.testRepeat: line 4, column 5:     Number of iterations: 4
20081218004520.788:Class.firstclass.testTestRepeat: line 35, column 9:     returning String from method public String testRepeat(Integer) in 2 ms
20081218004520.788:Class.firstclass: line 32, column 28:     returning from end of method static testMethod void testTestRepeat() in 2 ms
Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 500
Number of script statements: 8 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
*** Ending Test firstclass.static testMethod void testTestRepeat()
*** Beginning Test 2: firstclass.static testMethod void testDupEntries()
20081218004520.792:Class.firstclass: line 1, column 8: Static initialization: firstclass
20081218004520.792:Class.firstclass.testDupEntries: line 21, column 14: DeclareVar: LIST:String testDups
20081218004520.792:Class.firstclass.testDupEntries: line 21, column 14:     initial value: ()
20081218004520.792:Class.firstclass.testDupEntries: line 22, column 14: DeclareVar: LIST:String compareResult
20081218004520.792:Class.firstclass.testDupEntries: line 22, column 14:     initial value: ()
20081218004520.792:Class.firstclass.testDupEntries: line 23, column 9: DeclareVar: firstclass testClass
20081218004520.792:Class.firstclass: line 1, column 14: Instance initialization: firstclass
20081218004520.792:Class.firstclass.testDupEntries: line 23, column 9:     initial value: firstclass:[]
20081218004520.792:Class.firstclass.testDupEntries: line 24, column 9: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 25, column 9: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 26, column 9: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 27, column 9: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 28, column 9: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 29, column 9: system.assertEquals(LIST:String, LIST:String)
20081218004520.792:Class.firstclass.dupEntries: line 11, column 14: DeclareVar: LIST:String dupValues
20081218004520.792:Class.firstclass.dupEntries: line 11, column 14:     initial value: ()
20081218004520.792:Class.firstclass.dupEntries: line 12, column 13: DeclareVar: SET:String dupID
20081218004520.792:Class.firstclass.dupEntries: line 12, column 13:     initial value: {}
20081218004520.792:Class.firstclass.dupEntries: line 13, column 9: SelectLoop:LIST:String
20081218004520.792:Class.firstclass.dupEntries: line 15, column 21: LIST:String.add(String)
20081218004520.792:Class.firstclass.testDupEntries: line 30, column 13:     returning LIST:String from method public LIST:String dupEntries(LIST:String) in 0 ms
20081218004520.792:Class.firstclass: line 20, column 28:     returning from end of method static testMethod void testDupEntries() in 3 ms
Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 500
Number of script statements: 16 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
*** Ending Test firstclass.static testMethod void testDupEntries()
*** Beginning Test 3: SiteLeaseCumCostClass.static testMethod void SiteLeaseCumCostTrigger()
20081218004520.796:Class.SiteLeaseCumCostClass: line 1, column 8: Static initialization: SiteLeaseCumCostClass
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 48, column 9: DeclareVar: Decimal cst
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 48, column 9:     initial value: 3861.8125
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 49, column 9: DeclareVar: String tid
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 49, column 9:     initial value:
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 51, column 9: DeclareVar: SOBJECT:Site_Lessor__c lessor
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 51, column 9:     initial value: Site_Lessor__c:{Name=Testing2}
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 52, column 9: Insert: SOBJECT:Site_Lessor__c
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 52, column 9:     DML Operation executed in 25 ms
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 54, column 9: DeclareVar: SOBJECT:Site_Lease_Contract__c t
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 54, column 9:     initial value: Site_Lease_Contract__c:{Escalation_Month__c=8.0, Auto_Renewed__c=false, Lease_Term_In_Months__c=36.0, Escalation_Amount__c=5.0, Initial_Rent__c=100.0, Renew_Term__c=12.0, Start_Date__c=2008-12-17 00:00:00, Name=Name1, Renew_Addl_Terms__c=2.0}
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 58, column 17: Insert: SOBJECT:Site_Lease_Contract__c
*** Beginning SiteLeaseEndDateTrigger on Site_Lease_Contract trigger event BeforeInsert for null
20081218004520.834:Trigger.SiteLeaseEndDateTrigger: line 1, column 1: TriggerBody: SiteLeaseEndDateTrigger
20081218004520.834:Trigger.SiteLeaseEndDateTrigger: line 3, column 5: SiteLeaseEndDateClass.SiteLeaseEndDateTrigger(LIST:SOBJECT:Site_Lease_Contract__c)
20081218004520.834:Class.SiteLeaseEndDateClass: line 1, column 8: Static initialization: SiteLeaseEndDateClass
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 9: For
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 14: DeclareVar: Integer i
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 14:     initial value: 0
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 9, column 21: DeclareVar: Double mthsD
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 9, column 21:     initial value: 36.0
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 10, column 21: DeclareVar: Integer mths
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 10, column 21:     initial value: 36
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 11, column 21: DeclareVar: Double RmthsD
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 11, column 21:     initial value: 12.0
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 12, column 21: DeclareVar: Double RtrmsD
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 12, column 21:     initial value: 2.0
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 13, column 21: DeclareVar: Integer Rmths
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 13, column 21:     initial value: 60
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 15, column 22: Double mthsD <= ArrayReference.Lease_Term_In_Months__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 16, column 22: Integer mths <= MethodInvocation
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 17, column 22: Double RmthsD <= ArrayReference.Renew_Term__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 18, column 22: Double RtrmsD <= ArrayReference.Renew_Addl_Terms__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 19, column 22: Integer Rmths <= Add
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 21, column 22: Double mthsD <= ArrayReference.Lease_Term_In_Months__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 22, column 22: Integer mths <= MethodInvocation
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 23, column 22: Double RmthsD <= ArrayReference.Renew_Term__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 24, column 22: Double RtrmsD <= ArrayReference.Renew_Addl_Terms__c
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 25, column 22: Integer Rmths <= Add
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 30, column 56: ArrayReference.End_Date__c <= Sub
20081218004520.834:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 9:     Number of iterations: 1
20081218004520.834:Trigger.SiteLeaseEndDateTrigger: line 3, column 5:     returning from end of method public static void SiteLeaseEndDateTrigger(LIST:SOBJECT:Site_Lease_Contract__c) in 4 ms
nwingnwing
and the second part...........  (sorry if I am not supposed to post these things)
 
 
 
Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 2 out of 100
Number of DML rows: 2 out of 500
Number of script statements: 24 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
*** Ending SiteLeaseEndDateTrigger on Site_Lease_Contract trigger event BeforeInsert for null
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 58, column 17:     DML Operation executed in 37 ms
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 59, column 17: String tid <= SOBJECT:Site_Lease_Contract__c t.Id
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 66, column 9: DeclareVar: SOBJECT:Site_Lease_Contract__c testCumCost1
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 66, column 45: SOQL query with 1 row finished in 11 ms
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 66, column 9:     initial value: Site_Lease_Contract__c:{Id=a0E40000000nb5AEAQ}
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9: system.debug(String)
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9:
Test Contract Result:Site_Lease_Contract__c:{Id=a0E40000000nb5AEAQ}
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 70, column 9: system.assertEquals(Decimal, Decimal)
System.Exception: Assertion Failed: Expected: 3861.8125, Actual: null
Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 70, column 9

Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 1 out of 100
Number of query rows: 1 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 2 out of 100
Number of DML rows: 2 out of 500
Number of script statements: 28 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
Stack frame variables and sizes:
  Frame0
*** Ending Test SiteLeaseCumCostClass.static testMethod void SiteLeaseCumCostTrigger()
*** Beginning Test 4: SiteLeaseEndDateClass.static testMethod void SiteLeaseEndDateTrigger()
20081218004520.876:Class.SiteLeaseEndDateClass: line 1, column 8: Static initialization: SiteLeaseEndDateClass
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 49, column 9: DeclareVar: Date dt0
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 49, column 9:     initial value: 2008-12-17 00:00:00
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 50, column 9: DeclareVar: Date dt1
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 50, column 9:     initial value: 2011-12-17 00:00:00
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 51, column 9: DeclareVar: Date dt2
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 51, column 9:     initial value: 2011-12-16 00:00:00
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 52, column 9: DeclareVar: Date rd0
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 52, column 9:     initial value: 2013-12-17 00:00:00
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 53, column 9: DeclareVar: Date rd1
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 53, column 9:     initial value: 2013-12-16 00:00:00
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 55, column 9: DeclareVar: SOBJECT:Site_Lessor__c lessor
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 55, column 9:     initial value: Site_Lessor__c:{Name=Testing}
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 56, column 9: Insert: SOBJECT:Site_Lessor__c
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 56, column 9:     DML Operation executed in 13 ms
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 58, column 9: DeclareVar: SOBJECT:Site_Lease_Contract__c s
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 58, column 9:     initial value: Site_Lease_Contract__c:{Escalation_Month__c=8.0, Auto_Renewed__c=false, Lease_Term_In_Months__c=36.0, Escalation_Amount__c=5.0, Initial_Rent__c=100.0, Renew_Term__c=12.0, Start_Date__c=2008-12-17 00:00:00, Name=Name1, Renew_Addl_Terms__c=2.0}
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 59, column 9: Insert: SOBJECT:Site_Lease_Contract__c
*** Beginning SiteLeaseEndDateTrigger on Site_Lease_Contract trigger event BeforeInsert for null
20081218004520.898:Trigger.SiteLeaseEndDateTrigger: line 1, column 1: TriggerBody: SiteLeaseEndDateTrigger
20081218004520.898:Trigger.SiteLeaseEndDateTrigger: line 3, column 5: SiteLeaseEndDateClass.SiteLeaseEndDateTrigger(LIST:SOBJECT:Site_Lease_Contract__c)
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 9: For
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 14: DeclareVar: Integer i
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 14:     initial value: 0
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 9, column 21: DeclareVar: Double mthsD
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 9, column 21:     initial value: 36.0
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 10, column 21: DeclareVar: Integer mths
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 10, column 21:     initial value: 36
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 11, column 21: DeclareVar: Double RmthsD
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 11, column 21:     initial value: 12.0
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 12, column 21: DeclareVar: Double RtrmsD
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 12, column 21:     initial value: 2.0
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 13, column 21: DeclareVar: Integer Rmths
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 13, column 21:     initial value: 60
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 15, column 22: Double mthsD <= ArrayReference.Lease_Term_In_Months__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 16, column 22: Integer mths <= MethodInvocation
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 17, column 22: Double RmthsD <= ArrayReference.Renew_Term__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 18, column 22: Double RtrmsD <= ArrayReference.Renew_Addl_Terms__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 19, column 22: Integer Rmths <= Add
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 21, column 22: Double mthsD <= ArrayReference.Lease_Term_In_Months__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 22, column 22: Integer mths <= MethodInvocation
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 23, column 22: Double RmthsD <= ArrayReference.Renew_Term__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 24, column 22: Double RtrmsD <= ArrayReference.Renew_Addl_Terms__c
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 25, column 22: Integer Rmths <= Add
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 30, column 56: ArrayReference.End_Date__c <= Sub
20081218004520.898:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 3, column 9:     Number of iterations: 1
20081218004520.898:Trigger.SiteLeaseEndDateTrigger: line 3, column 5:     returning from end of method public static void SiteLeaseEndDateTrigger(LIST:SOBJECT:Site_Lease_Contract__c) in 4 ms
Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 2 out of 100
Number of DML rows: 2 out of 500
Number of script statements: 27 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
*** Ending SiteLeaseEndDateTrigger on Site_Lease_Contract trigger event BeforeInsert for null
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 59, column 9:     DML Operation executed in 29 ms
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 61, column 9: DeclareVar: SOBJECT:Site_Lease_Contract__c testEndDate1
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 61, column 45: SOQL query with 1 row finished in 6 ms
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 61, column 9:     initial value: Site_Lease_Contract__c:{End_Date__c=2011-12-16 00:00:00, Id=a0E40000000nb5BEAQ}
20081218004520.876:Class.SiteLeaseEndDateClass.SiteLeaseEndDateTrigger: line 63, column 9: system.assertEquals(Date, Date)
20081218004520.876:Class.SiteLeaseEndDateClass: line 47, column 28:     returning from end of method static testMethod void SiteLeaseEndDateTrigger() in 54 ms
Cumulative resource usage:
Resource usage for namespace: (default)
Number of SOQL queries: 1 out of 100
Number of query rows: 1 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 2 out of 100
Number of DML rows: 2 out of 500
Number of script statements: 29 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 20
Total email recipients queued to be sent : 0
*** Ending Test SiteLeaseEndDateClass.static testMethod void SiteLeaseEndDateTrigger()
Cumulative profiling information:
No profiling information for SOQL operations.
No profiling information for SOSL operations.
No profiling information for DML operations.
No profiling information for method invocations.
nwingnwing
I was thinking, the code test succeeds just fine in the 'run test' mode in the IDE, but when I try to deploy it to production, I get 0% testing errors along with all the lines of code that were not tested, etc..  SO, I was wondering if perhaps the trigger deploy was choking, and that was causing the problem.
 
The trigger is not in the system, and when I deploy that separately I get this for the deploy log.......
 
*** Deployment Log ***
Result: FAILED
Date: December 17, 2008 5:03:17 PM PST
# Deployed From:
   Project name: SiteLeaseCumCostUpdate
   Username: 
   Endpoint: www.salesforce.com
# Deployed To:
   Username: 
   Endpoint: www.salesforce.com
# Deploy Results:
   Name:    triggers/SiteLeaseCumCostTrigger.trigger
   Action:  NO ACTION
   Result:  FAILED
   Problem: Method does not exist or incorrect signature: SiteLeaseCumCostClass.SiteLeaseCumCostTrigger(LIST:SOBJECT:Site_Lease_Contract__c)
   Name:    package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a
# Test Results:
   n/a
 
Here is the trigger code....not sure if this is an issue......but...........
 
Code:
trigger SiteLeaseCumCostTrigger on Site_Lease_Contract__c (before update, before insert) {

 SiteLeaseCumCostClass.SiteLeaseCumCostTrigger( Trigger.new );

}

 
JimRaeJimRae
It appears, based on this log:

20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9: system.debug(String)
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 68, column 9:
Test Contract Result:Site_Lease_Contract__c:{Id=a0E40000000nb5AEAQ}
20081218004520.796:Class.SiteLeaseCumCostClass.SiteLeaseCumCostTrigger: line 70, column 9: system.assertEquals(Decimal, Decimal)
System.Exception: Assertion Failed: Expected: 3861.8125, Actual: null

that your Cum_Cost__c field is not even getting returned with your resulting test record.  Are you sure that the objects are the same in test and in production.  Does the Site_Lease_Contract__c have the same fields in both production and test, and the same permissions for visibility?
In test, you will notice that your retrieved test contract looks like this:
Test Contract Result:Site_Lease_Contract__c:{Cum_Cost__c=3861.8125, Id=a018000000Lr8Z6AAJ}
I am surprised you are not getting some other type of error, but I would look at the metadata for both production and test first, for a possible discrepancy.



nwingnwing

In the UI's everything looks good.  Is there someplace in particular you would recommend to look....the metadata wsdl?

 

JimRaeJimRae
No, just make sure the same custom field is in both the development and production version, and has the same attributes, including field level security.  I assume you have administrative access in both development and in Production, you could also try this, just to see.

Open your System Log in development, available from a link at the top of every page, next to the Setup link.

in the bottom pane, paste this code, and press "Execute Apex", save the log that is generated.

Repeat in your production instance to see what the difference might be.

Code:
Map<String, Schema.SObjectField> M = Schema.SObjectType.Site_Lease_Contract__c.fields.getMap();
system.debug('\n\nSTART SAVING HERE');
system.debug('\n\n'+M);
system.debug('\n\n'+M.get('Cum_Cost__c').getDescribe());
system.debug('\n\nSTOP SAVING HERE');

 

nwingnwing
Prod System  -  Looks Good
 
Code:
09:02:04 DEBUG - Executing: Map<String, Schema.SObjectField> M = Schema.SObjectType.Site_Lease_Contract__c.fields.getMap();
system.debug('\n\nSTART SAVING HERE');
system.debug('\n\n'+M);
system.debug('\n\n'+M.get('Cum_Cost__c').getDescribe());
system.debug('\n\nSTOP SAVING HERE');
09:02:04 DEBUG - Executing: Map<String, Schema.SObjectField> M = Schema.SObjectType.Site_Lease_Contract__c.fields.getMap();
system.debug('\n\nSTART SAVING HERE');
system.debug('\n\n'+M);
system.debug('\n\n'+M.get('Cum_Cost__c').getDescribe());
system.debug('\n\nSTOP SAVING HERE');
09:02:05 INFO  - 20081218170200.536:AnonymousBlock: line 2, column 1: 

START SAVING HERE
20081218170200.536:AnonymousBlock: line 3, column 1: 

{activated__c=Activated__c, activation_date__c=Activation_Date__c, auto_renewed__c=Auto_Renewed__c, contact__c=Contact__c, createdbyid=CreatedById, createddate=CreatedDate, cum_cost__c=Cum_Cost__c, end_date__c=End_Date__c, escalation_amount__c=Escalation_Amount__c, escalation_month__c=Escalation_Month__c, ...}
20081218170200.536:AnonymousBlock: line 4, column 1: 

Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Cumulative Cost;getLength=0;getLocalName=Cum_Cost__c;getName=Cum_Cost__c;getPrecision=10;getRelationshipName=null;getRelationshipOrder=null;getScale=4;getSoapType=Schema.SoapType.DOUBLE;getSobjectField=Cum_Cost__c;getType=Schema.DisplayType.CURRENCY;isAccessible=true;isAutoNumber=false;isCalculated=false;isCaseSensitive=false;isCreateable=true;isCustom=true;isDefaultedOnCreate=false;isDependentPicklist=false;isExternalId=false;isFilterable=true;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isSortable=true;isUnique=false;isUpdateable=true;isWriteRequiresMasterRead=false;]
20081218170200.536:AnonymousBlock: line 5, column 1: 

STOP SAVING HERE

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 5 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 1 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 0

Total email recipients queued to be sent : 0
Static variables and sizes:
M:440

Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


09:02:05 INFO  - 20081218170200.536:AnonymousBlock: line 2, column 1: 

START SAVING HERE
20081218170200.536:AnonymousBlock: line 3, column 1: 

{activated__c=Activated__c, activation_date__c=Activation_Date__c, auto_renewed__c=Auto_Renewed__c, contact__c=Contact__c, createdbyid=CreatedById, createddate=CreatedDate, cum_cost__c=Cum_Cost__c, end_date__c=End_Date__c, escalation_amount__c=Escalation_Amount__c, escalation_month__c=Escalation_Month__c, ...}
20081218170200.536:AnonymousBlock: line 4, column 1: 

Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Cumulative Cost;getLength=0;getLocalName=Cum_Cost__c;getName=Cum_Cost__c;getPrecision=10;getRelationshipName=null;getRelationshipOrder=null;getScale=4;getSoapType=Schema.SoapType.DOUBLE;getSobjectField=Cum_Cost__c;getType=Schema.DisplayType.CURRENCY;isAccessible=true;isAutoNumber=false;isCalculated=false;isCaseSensitive=false;isCreateable=true;isCustom=true;isDefaultedOnCreate=false;isDependentPicklist=false;isExternalId=false;isFilterable=true;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isSortable=true;isUnique=false;isUpdateable=true;isWriteRequiresMasterRead=false;]
20081218170200.536:AnonymousBlock: line 5, column 1: 

STOP SAVING HERE

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 5 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 1 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 0

Total email recipients queued to be sent : 0
Static variables and sizes:
M:440

Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


09:02:05 DEBUG - Success

 
nwingnwing
Test System - Looks Good
 
Code:
09:05:05 DEBUG - Executing: Map<String, Schema.SObjectField> M = Schema.SObjectType.Site_Lease_Contract__c.fields.getMap();
system.debug('\n\nSTART SAVING HERE');
system.debug('\n\n'+M);
system.debug('\n\n'+M.get('Cum_Cost__c').getDescribe());
system.debug('\n\nSTOP SAVING HERE');
09:05:05 DEBUG - Executing: Map<String, Schema.SObjectField> M = Schema.SObjectType.Site_Lease_Contract__c.fields.getMap();
system.debug('\n\nSTART SAVING HERE');
system.debug('\n\n'+M);
system.debug('\n\n'+M.get('Cum_Cost__c').getDescribe());
system.debug('\n\nSTOP SAVING HERE');
09:05:05 INFO  - 20081218170501.146:AnonymousBlock: line 2, column 1: 

START SAVING HERE
20081218170501.146:AnonymousBlock: line 3, column 1: 

{activated__c=Activated__c, activation_date__c=Activation_Date__c, auto_renewed__c=Auto_Renewed__c, contact__c=Contact__c, createdbyid=CreatedById, createddate=CreatedDate, cum_cost__c=Cum_Cost__c, end_date__c=End_Date__c, escalation_amount__c=Escalation_Amount__c, escalation_month__c=Escalation_Month__c, ...}
20081218170501.146:AnonymousBlock: line 4, column 1: 

Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Cumulative Cost;getLength=0;getLocalName=Cum_Cost__c;getName=Cum_Cost__c;getPrecision=10;getRelationshipName=null;getRelationshipOrder=null;getScale=4;getSoapType=Schema.SoapType.DOUBLE;getSobjectField=Cum_Cost__c;getType=Schema.DisplayType.CURRENCY;isAccessible=true;isAutoNumber=false;isCalculated=false;isCaseSensitive=false;isCreateable=true;isCustom=true;isDefaultedOnCreate=false;isDependentPicklist=false;isExternalId=false;isFilterable=true;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isSortable=true;isUnique=false;isUpdateable=true;isWriteRequiresMasterRead=false;]
20081218170501.146:AnonymousBlock: line 5, column 1: 

STOP SAVING HERE

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 5 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 1 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 0

Total email recipients queued to be sent : 0
Static variables and sizes:
M:440

Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


09:05:05 INFO  - 20081218170501.146:AnonymousBlock: line 2, column 1: 

START SAVING HERE
20081218170501.146:AnonymousBlock: line 3, column 1: 

{activated__c=Activated__c, activation_date__c=Activation_Date__c, auto_renewed__c=Auto_Renewed__c, contact__c=Contact__c, createdbyid=CreatedById, createddate=CreatedDate, cum_cost__c=Cum_Cost__c, end_date__c=End_Date__c, escalation_amount__c=Escalation_Amount__c, escalation_month__c=Escalation_Month__c, ...}
20081218170501.146:AnonymousBlock: line 4, column 1: 

Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Cumulative Cost;getLength=0;getLocalName=Cum_Cost__c;getName=Cum_Cost__c;getPrecision=10;getRelationshipName=null;getRelationshipOrder=null;getScale=4;getSoapType=Schema.SoapType.DOUBLE;getSobjectField=Cum_Cost__c;getType=Schema.DisplayType.CURRENCY;isAccessible=true;isAutoNumber=false;isCalculated=false;isCaseSensitive=false;isCreateable=true;isCustom=true;isDefaultedOnCreate=false;isDependentPicklist=false;isExternalId=false;isFilterable=true;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isSortable=true;isUnique=false;isUpdateable=true;isWriteRequiresMasterRead=false;]
20081218170501.146:AnonymousBlock: line 5, column 1: 

STOP SAVING HERE

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 5 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 1 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 0

Total email recipients queued to be sent : 0
Static variables and sizes:
M:440

Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


09:05:05 DEBUG - Success

 
nwingnwing

I just finished building the same app/objects/fields in our official production system (we have two, one for testing) and I get the exact same issues when trying to deploy to it.

I am wondering, would data type/decimal places cause any kinds of issues?  I am using both currency and double and decimal fields and I am not sure how the assignment to variables and between the math calcs might be affected........I don't know..........I am grasping at straws here.

JimRaeJimRae
I am not sure, you really have me stumped.  It appears that your SOQL query is not returning that field in the production instance, but I don't know why.  Is that field on any page layout you are using in the production instance?  Can you see the field if you access the object via the UI?  Can you insert data into it?  Is it available in any report views?  I am not sure, never seen anything like it.  You may need to log a tech support call on this one.
nwingnwing
Thanks
Jim VERY VERY much for your help up to this point in any case.
 
I have been going through everything with a FTC, and I could get nothing to change.  However, I set up the currency field (Cumulative Cost) with a default value of 1000, and I did get different results.  That query that didn't look like it was pulling anything did pull the field now that it has a value.....though of course, it is the wrong value of $1000, and not the value that should be calced on update/insert....
 
It looks like the trigger is not firing for some reason, and for the life of me I cannot figure out why........
 
Can I call the normal help desk on this?
 
thanks,
 
 
JimRaeJimRae
No problem, I wish we could have solved it.  I would say, the trigger is firing, you can see it in the debug log, where it shows what method is executing and the line item.
So the problem is either, the field is not getting updated, or at least in production, your test method is not returning the same record you are updating.

I am snowed in here in Michigan today, might have another look at your trigger and testmethod if I get a chance.

Not sure if you can log a case with tech support on this or not.  Our company has premier support, so I use that.
I would guess you could, wouldn't hurt.

Good Luck!
JimRaeJimRae
You know, I have a silly question, when you deploy to production, you are selecting the trigger and the testmethod, right?

You might want to add a debug line to the trigger as well, just to make sure it is getting deployed.
Something like this would do the trick:

Code:
trigger SiteLeaseCumCostTrigger on Site_Lease_Contract__c (before update, before insert) {
 system.debug('\n\nIN THE SiteLeaseCumCostTrigger code');
 SiteLeaseCumCostClass.SiteLeaseCumCostTrigger( Trigger.new );

}

 

sparktestsparktest
 
Jim,  If you ever need anything, just let me know.  :) 
 
For some reason I got away with not deploying in said fashion on the other classes/triggers I have created, so I didn't think of that as a possible issue........I just assumed it pulled the trigger along with it/vice-a-versa when you deployed.
 
It loaded just fine.....now that I think about it I do remember seeing something along those lines..........
 
In any case, I have learned a TON in the meantime....so it was probably beneficial......for me anyway......though I apologize for taking up your time on something so trivial........
 
thanks!