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
Dilip KulkarniDilip Kulkarni 

Trigger change

Hi,
I wrote trigger as following:

trigger UpdateSADeclined on Task (before insert,before update) {
for(Task x: Trigger.new)
{
If (x.Declined_by__c==null|| x.Date_Time_Declined__c==null|| x.Declined_Reason__c==null)
{
x.SA_Declined__c=true;
}
else
{ x.SA_Declined__c=false;
}
}
}
By this trigger checkbox field SADeclined is checked whenever any of date field value ( declined by, date time declined and declined reason) is null, otherwise it’s unchecked ( means whenever all three fields are populated).

Now, My requirement is whenever there is value in date field SADeclined should be unchecked, i.e. when all three date fields are null the SADeclined will be checked.
Kindly help me to change the trigger.
_Prasu__Prasu_
Replace || with && 
If (x.Declined_by__c==null && x.Date_Time_Declined__c==null && x.Declined_Reason__c==null)


 
Dilip KulkarniDilip Kulkarni
Hi,
I did it with ! operator. Thank you for reply.