You need to sign in to do that
Don't have an account?

0% code coverage in production but 98 % in sandbox
this is my following code
trigger BeforeUpdateGoalYears on Goal__c (before update) { for(Integer j = 0; trigger.new.size()>j; j++){ for(Integer i = 0; trigger.old.size()>i; i++){ if(trigger.old[i].id == trigger.new[j].id){ if(!(trigger.old[i].Goal_Start_Year__c == trigger.new[j].Goal_Start_Year__c && trigger.old[i].Goal_End_Year__c == trigger.new[j].Goal_End_Year__c)){ trigger.new[j].moderately_aggressive_profile_years__c = null; trigger.new[j].moderately_conservative_profile_years__c = null; trigger.new[j].aggressive_profile_years__c = null; trigger.new[j].conservative_profile_years__c = null; trigger.new[j].moderate_profile_years__c = null; } } } } }
what will be the reson for that please help
Hello,
Can you please upload the test method??????????
thanks!!!!!!!!!!!!!! ashish
this is the code of the test class which excute the trriger
your help will make a lot of good to me
Hello,
Can you tell me wats acc.id???? If it is account id than first of all insert an account inside your test method then pass that accunt id inside the desired field of Goal__c. Like this:
Account accnt=new account(name="test Account"); // You have to find the mandatory field before inserting a account.
insert accnt;
now pass this id like
gol=new gol__c(Entity__c=accnt.id,..................................... and other filds)
insert gol;
Think this will help you.
Hello,
Never try to query inside the test method because it may be possible when you have written the query inside that org , you have the record related to that query but when you move that code from one org to another that record may not exsist. So my openion is when ever you need to query inside the test method its better you insert such kind of records. I think you have made a query on profile also. So try to avoid that than you will get the desired coverage in production org also.