You need to sign in to do that
Don't have an account?
lucky013219147071527237
can u please help me how to write this trigger test class
trigger controlaAreaTalhaoAutomaticoBefore on Talhao__c (before insert, before update) {
for(Talhao__c talhao:Trigger.new){
if(talhao.Impede_Trigger_Area_Talhao_Automatico__c){
Util.impedeTriggerAreaTalhaoAutomatico = true;
talhao.Impede_Trigger_Area_Talhao_Automatico__c = false;
}
if(talhao.Area_do_Talhao__c == null || talhao.Area_do_Talhao__c < 0)
talhao.addError('Área do Talhão: Inserir um valor positivo.');
}
}
for(Talhao__c talhao:Trigger.new){
if(talhao.Impede_Trigger_Area_Talhao_Automatico__c){
Util.impedeTriggerAreaTalhaoAutomatico = true;
talhao.Impede_Trigger_Area_Talhao_Automatico__c = false;
}
if(talhao.Area_do_Talhao__c == null || talhao.Area_do_Talhao__c < 0)
talhao.addError('Área do Talhão: Inserir um valor positivo.');
}
}
first provide the data staticly to Talhao__c object and perform insert and update operation .