I have criteria in the workflow which need to convert to apex code. Here is the WF rule and criteria to convert.
Rule Criteria: Opportunity: Status EQUALS Service
Evaluation Criteria: Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria
In apex class, I written logic like below:
if(Trigger.isUpdate){
if(opp.status = 'Service'){
opp.count__c = 0;
}
}
but when updating the record though criteria are already met, this condition is always executing and updating the record. How to make this not execute if already satisfied and updated. Please help me.