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
ne-rm-teamne-rm-team 

Problems with testMethods when I try to assert or read rollup fields

Hi,
 
i wrote an apex script that works fine in my sandbox. Even the testMethod displays an 100% test coverage and all system asserts are correct.
 
But when i try to deploy the code to my productional system, i get an error from the deploymend wizard. The values that i try to read are always zero.
 
Can it be, that i'm getting these zero results because the rollup-fields are not so fast updated? This is the only thing I can image, but on the other side, why are the asserts correct in the sandbox?
 
The sandbox update is new and the code not realy complicated. The only thing I do is, to copy a rollup field-value from a master object, when I change a value of one related child object.
 
Hase anyone expirianced the same or any ideas whats going wrong?
 
P.S.
I added some queries to my testMethod and found out, that the master-record "Komponenten_Version__c" hase a amount of zero in the rollup-field "Planaufwand_Tage__c" although there are two child-records "technische_Funktionalitaet__c" related to the master-record which should create a amount of 5 in the roll-up field "Planaufwand_Tage__c".
 
Komponenten_Version__c:{Status__c=1 - in Planung, Name=KV1, Planaufwand_Tage__c=0.0, Id=a0Z200000001j5xEAA}
technische_Funktionalitaet__c:{Komponenten_Version__c=a0Z200000001j5xEAA, Doku_Tage__c=2.0, Name=tf1, Planaufwand_Tage__c=2.0, Id=a0N200000001jr5EAA},
technische_Funktionalitaet__c:{Komponenten_Version__c=a0Z200000001j5xEAA, Doku_Tage__c=3.0, Name=tf2, Planaufwand_Tage__c=3.0, Id=a0N200000001jr6EAA})
Looks like I can't fetch roll-up-fields with testMethods in my production environment?!?!
 
Thanks for any help.
 
Best regards
Sascha


Message Edited by ne-rm-team on 11-28-2008 02:28 AM

Message Edited by ne-rm-team on 11-28-2008 04:39 AM