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
Mohit JoshiMohit Joshi 

I need my trigger to fireonly when a checkbox field changes 'unchecked ' to 'checked' not the the other way around.. I can't think of anything.

Hemant_JainHemant_Jain
See if below code helps,
if (Trigger.isUpdate){
            for (YourObject obj : trigger.new){
                if (!(Trigger.oldMap.get(obj.Id).ChecboxField__c) &&  obj.CheckboxField__c){
}
}
Waqar Hussain SFWaqar Hussain SF
Trigger OpportunityTrigger on Opportunity (after insert, after update){

for(Opportunity opp : trigger.new){

if(trigger.oldmap.get(opp.Id).opp.CheckBoxField__c == false && opp.CheckboxField__c == true){
 //run your script here 

}

}

}

 
Waqar Hussain SFWaqar Hussain SF
Trigger OpportunityTrigger on Opportunity (after update){

for(Opportunity opp : trigger.new){

if(trigger.oldmap.get(opp.Id).opp.CheckBoxField__c == false && opp.CheckboxField__c == true){
 //run your script here 

}

}

}

 
Jyothylakshmy P U 1Jyothylakshmy P U 1
Trigger OpportunityTrigger on Opportunity (after update){
for(Opportunity opp : trigger.new){
if (Trigger.isUpdate){
if(trigger.oldmap.get(opp.Id).opp.CheckBoxField__c == false && opp.CheckboxField__c == true)
{ //run your script here }
}
}
}